Event Binding in Angular || Angular Event binding [Imp Angular Interview Concept]

Pubblicato il: 01 dicembre 2019
sul canale di: Code Decode
3,504
29

Event Binding in Angular || Angular Event binding | Angular | Angular Tutorial for Beginners | Angular |

Angular Event Binding
we have discussed so far how data flows in one direction i.e from a component class property to an HTML element property.
How about data flow from template to component on user actions.
How to capture user events, user actions, button clicks, link clicks, user inputs in input html elements. how to sen data from UI to database or backend.

We can use angular event binding to get notified when these events occur.
For example the following is the syntax for binding to the click event of a button. Within parentheses on the left of the equal sign we have the target event, (click) in this case and on the right we have the template statement. In this case the onClick() method of the component class is called when the click event occurs.
[button (click)="onClick()"]Click me[/button]

Event Binding:

The interpolation and property binding are one way binding from component to view.
Event binding is used to perform an action in the component (may be executing a method) when user-raise a event – like click on button
Event binding uses the parenthesis. And name of the event is enclosed in parenthesis and then it assigned to the statement which mostly the method in the component class


In questa pagina del sito puoi guardare il video online Event Binding in Angular || Angular Event binding [Imp Angular Interview Concept] della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Code Decode 01 dicembre 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 3,504 volte e gli è piaciuto 29 spettatori. Buona visione!