Sunday, 3 November 2019

What is event binding in angular?


Event Binding:  Below all are one direction data binding where data binds from component to view template i.e. to HTML

1. Interpolation
2. Property Binding
3. Attribute Binding
4. Class Binding
5. Style Binding

But in some cases, we need binding from view template to component class. This means let say we have a button click event. As per the click event the changes need to happen in the view template. In this case data should flow from view template to component. For this we can use event binding.
Below is the example







No comments:

Post a Comment