13

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

2 Answers 2

5

https://github.com/angular/angular/issues/6675

Oct 3 2016

not planned in a near future

Sign up to request clarification or add additional context in comments.

1 Comment

I saw they closed the issue, but we still don't have this feature. Someone knows any news about that?
0

You can try this :

<input #email (blur)="emailIdCheck(email.value)" (keydown.tab)="email.blur()" type="text" placeholder="Your Email ID">

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.