ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Ion-Tab: Click event fires multiple times

Open wouterDumon opened this issue 10 years ago • 2 comments

Short description of the problem:

When setting an [click] or [select] event on a tab the event fire's more than once.

What behavior are you expecting?

Click only fires once when clicking on it.

Steps to reproduce:

  1. Put the plunkr code into a new project
  2. run it
  3. open the console
  4. you'll see that when launching the app it'll say 17 times clicked and when clicking the tab it also shows multiple times "clicked".

insert any relevant code between the above and below backticks `` <ion-tab [root]="tab1Root" tabTitle="Tab 1" tabIcon="pulse" [click]="clickevent()"> clickevent(){ console.log("Clicked"); }`

Which Ionic Version? 2.x

Plunker that shows an example of your issue

http://plnkr.co/edit/eebNspnniClOq2IJLp8X?p=preview

Instructions: open the console to see multiple times "clicked".

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.1.1 Gulp version: CLI version 1.2.1 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.6 Ionic CLI Version: 2.0.0-beta.25 Ionic App Lib Version: 2.0.0-beta.15 OS: Node Version: v4.1.0

Other relevant info:

The idea behind putting an click event on the ion-tab is to show a pop-up where you can choose between multiple tabs

wouterDumon avatar May 11 '16 10:05 wouterDumon

Hello! Thanks for opening an issue with us! Here is a plunker that shows the correct way to bind to an event in Angular 2/Ionic 2. () is used when binding to an event and [] is for binding to an attribute. Also, here is a link to the official angular 2 documentation on using () to bind to events. Thanks for using Ionic! And feel free to comment if you have any more questions!

jgw96 avatar May 11 '16 15:05 jgw96

Hi, with using the () the function doesn't work. I ran your plunker and there's nothing to see in the console.

elineopsommer avatar May 12 '16 09:05 elineopsommer