Component with Output


#1

Can anyone show me an example of how to use output in components?

I tried to follow this example: https://angular.io/docs/ts/latest/api/core/Output-var.html

But i had no success ;(
Thanks


#2

We use the @Output decorator on components in the Ionic source. Here is an example of a blur event on the Searchbar component:

https://github.com/driftyco/ionic/blob/2.0/ionic/components/searchbar/searchbar.ts#L101

https://github.com/driftyco/ionic/blob/2.0/ionic/components/searchbar/searchbar.ts#L252

Then when you go to use the component:

<ion-searchbar [(ngModel)]="defaultSearch" (blur)="inputBlurred($event)"></ion-searchbar>

And the inputBlurred function will get the Searchbar object.


#3

links don’t work, can you paste the examples ?


#4

Hi,

You need to read the Angular2+ documentarion.