Reputation: 2372
Here is my component's template
<input #emailId (focusout)="emailIdCheck(emailId.value)" #emailIDD (keydown.tab)="emailIdCheck(emailIDD.value)" type="text" placeholder="Your Email ID">
As you can see I have bound the focusout
event as well as keydown.tab (tab keydown)
event to a method in my component class.
But this looks ugly and does not scale well if I want to bind a number of events.
Is there a possibility to have something like the below?
<input #emailId (focusout|keydown.tab)="emailIdCheck(emailId.value)" type="text" placeholder="Your Email ID">
Disclaimer: I started practicing angular2 couple of weeks back and am still new
Upvotes: 13
Views: 15385
Reputation: 1
You can try this :
<input #email (blur)="emailIdCheck(email.value)" (keydown.tab)="email.blur()" type="text" placeholder="Your Email ID">
Upvotes: 0
Reputation: 657238
https://github.com/angular/angular/issues/6675
Oct 3 2016
not planned in a near future
Upvotes: 5