1.

Explain event binding in Angular?

Answer»

Event binding in Angular is used to respond to some DOM events. For example, actions on click of BUTTONS require event binding. In this very specific example, the click event is required to be bound to a method in the code so whenever the user clicks on the button, the click event is fired which in turn executes the bound method. This is called event binding.

There are many different events exposed by the HTML and JS APIs that developers can use to PERFORM actions. Here is an example of event binding.

<button CLASS="btn btn-success"  (click)="registerUser()">Register</button>

The above is the simplest example of event binding in Angular. The method registerUser() will be executed every time the user clicks on the button.



Discussion

No Comment Found