Ng-blur, ng-focus and Ionic 2?

Hi,

Can anyone tell me why I’m not triggering the focus and unfocused events on my input?

Thanks

<ion-input ng-focus="visitingInput()" ng-blur="visitedInput()"></ion-input>

visitingInput()
{
    console.log("hit");
}

visitedInput()
{
    console.log("hit2");
}

Because Ionic 2 is based Angular 2, and Angular 2 has no ng-focus directive. You’ll want to use the event binding syntax instead.

thanks, (focus) and (blur) worked.

1 Like