devxoss
1
Hi,
I am using gesture in ion-item, as shown below -
<ion-item *ngFor="let taskInfo_ of task_.task_list; let j = index" (tap)="getTaskDetailsPage(taskInfo_,task_)" (press)="pressEvent($event, taskInfo_)" [ngClass]="taskInfo_.task_priority">
- If I do long press then it does but tap too.
So How can I handle this ?
Thanks
i run this code on my chrome browser, and the result is different with you
<ion-content padding>
<ion-list>
<ion-item *ngFor="let item of items" (tap)="itemTapped($event, item)" (press)="itemPressed($event)">
<ion-icon name="{{ item.icon }}" item-left></ion-icon>
<h2>{{ item.title }}</h2>
<p>{{ item.note }}</p>
</ion-item>
</ion-list>
home.ts
export class HomePage {
selectedItem: any;
icons: string[];
items: Array<{ title: string, note: string, icon: string }>;
constructor(
private navCtrl: NavController,
navParams: NavParams) {
// If we navigated to this page, we will have an item available as a nav param
this.selectedItem = navParams.get('item');
this.icons = ['flask', 'wifi', 'beer', 'football', 'basketball', 'paper-plane',
'american-football', 'boat', 'bluetooth', 'build'];
this.items = [];
for (let i = 1; i < 20; i++) {
this.items.push({
title: 'Item ' + i,
note: 'This is item #' + i,
icon: this.icons[Math.floor(Math.random() * this.icons.length)]
});
}
}
setTimeout(() => {
loading.dismiss();
}, 1000);
}
itemPressed(e) {
console.log("itemPressed");
alert("itemPressed");
}
itemTapped(event, item) {
this.navCtrl.push(ItemDetailsPage, {
item: item
});
console.log("push ItemDetailsPage over");
}
}
devxoss
5
At Long press , I am giving alert which is automatically dismiss itself. May I know why this is happing?