Reputation: 982
I have a simple SearchWidgetComponent that contains an input box. This would also display search results using li
elements. I need to attach different event listeners to the input box like keydown, keyup, focus and blur. I would also need to attach mouse events on the li
elements.
What is the proper way of attaching these event listeners to these elements inside a component?
Upvotes: 0
Views: 48
Reputation: 60528
Have you looked at event binding? https://angular.io/guide/user-input
<input id="productNameId"
type="text"
[(ngModel)] = product.productName
(keyup) = "onKeyUp()"
name="productName" />
Upvotes: 1