mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
docs(reorder-group): add type to the event param (#22157)
Improve Angular example by adding missing (`any`) typehint of the event
This commit is contained in:
@ -88,6 +88,7 @@ The `detail` property of the `ionItemReorder` event includes all of the relevant
|
||||
```javascript
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonReorderGroup } from '@ionic/angular';
|
||||
import { ItemReorderEventDetail } from '@ionic/core';
|
||||
|
||||
@Component({
|
||||
selector: 'reorder-group-example',
|
||||
@ -99,7 +100,7 @@ export class ReorderGroupExample {
|
||||
|
||||
constructor() {}
|
||||
|
||||
doReorder(ev: any) {
|
||||
doReorder(ev: CustomEvent<ItemReorderEventDetail>) {
|
||||
// The `from` and `to` properties contain the index of the item
|
||||
// when the drag started and ended, respectively
|
||||
console.log('Dragged from index', ev.detail.from, 'to', ev.detail.to);
|
||||
@ -121,6 +122,7 @@ export class ReorderGroupExample {
|
||||
```javascript
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonReorderGroup } from '@ionic/angular';
|
||||
import { ItemReorderEventDetail } from '@ionic/core';
|
||||
|
||||
@Component({
|
||||
selector: 'reorder-group-example',
|
||||
@ -134,7 +136,7 @@ export class ReorderGroupExample {
|
||||
|
||||
constructor() {}
|
||||
|
||||
doReorder(ev: any) {
|
||||
doReorder(ev: CustomEvent<ItemReorderEventDetail>) {
|
||||
// Before complete is called with the items they will remain in the
|
||||
// order before the drag
|
||||
console.log('Before complete', this.items);
|
||||
|
@ -72,6 +72,7 @@
|
||||
```javascript
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonReorderGroup } from '@ionic/angular';
|
||||
import { ItemReorderEventDetail } from '@ionic/core';
|
||||
|
||||
@Component({
|
||||
selector: 'reorder-group-example',
|
||||
@ -83,7 +84,7 @@ export class ReorderGroupExample {
|
||||
|
||||
constructor() {}
|
||||
|
||||
doReorder(ev: any) {
|
||||
doReorder(ev: CustomEvent<ItemReorderEventDetail>) {
|
||||
// The `from` and `to` properties contain the index of the item
|
||||
// when the drag started and ended, respectively
|
||||
console.log('Dragged from index', ev.detail.from, 'to', ev.detail.to);
|
||||
@ -105,6 +106,7 @@ export class ReorderGroupExample {
|
||||
```javascript
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonReorderGroup } from '@ionic/angular';
|
||||
import { ItemReorderEventDetail } from '@ionic/core';
|
||||
|
||||
@Component({
|
||||
selector: 'reorder-group-example',
|
||||
@ -118,7 +120,7 @@ export class ReorderGroupExample {
|
||||
|
||||
constructor() {}
|
||||
|
||||
doReorder(ev: any) {
|
||||
doReorder(ev: CustomEvent<ItemReorderEventDetail>) {
|
||||
// Before complete is called with the items they will remain in the
|
||||
// order before the drag
|
||||
console.log('Before complete', this.items);
|
||||
|
Reference in New Issue
Block a user