Angular 6 - Data Binding Part 2



 Data Binding - 2

Event Binding

Event binding used to build interactive angular applications with the flow of data from component to the element and from element to component.Event binding syntax will have a target event name within parentheses on the left of an equal sign, and a quoted template statement on the right.

Eg 1: In this example I used a button to demonstrate the event binding.

In here we are binding an onClick() event to the button element. When the user clicks on the button, event binding listens to the button's click event and calls the component's onClick() method in component.ts file.



Eg:2 . In here there is a method named "onUpdateServerName" and add an event with it.




Comments

Post a Comment

Popular posts from this blog

Machine Learning

Angular