
上QQ阅读APP看书,第一时间看更新
Event binding an $event object
Angular makes an $event object available whenever the target event is triggered. This $event contains the details of the event that occurred.
The important thing to note here is that the shape of the $event object is decided based on the event type. For HTML elements, it is a DOM event object (https://developer.mozilla.org/en-US/docs/Web/Events), which may vary based on the actual event.
But if it is a custom component event, what is passed in the $event object is decided by the component implementation.
We have now covered most of the data binding capabilities of Angular, with the exception of two-way binding. A quick introduction to the two-way binding constructs is warranted before we conclude the chapter.