One of the primary functions of an application is to respond to user interactions using events. In Angular, we use DOM events. In order to invoke code in response to the execution of an event in an Angular application, we want to use Event Binding. Event Binding allows us to provide a template statement that should be executed when the bound event is invoked.

The syntax for an Angular Event Binding is as follows:

(eventName)=”templateStatement”

templateStatement(){
//your code goes here
}

Simply wrap the DOM event name in open/close parenthesis and set the value equal to a method you define in your component class.

For a list of common event names, see the angular event documentation.

“Desktop to Web: A WPF Developers Guide to Learning Angular” is a video tutorial series that will help you take your WPF and WinForms desktop coding skill to the web with Angular. This series will help you understand how your current desktop skills map directly to concepts in Angular to make your learning path to the web as easy and painless as possible.

During each video in this series I will be giving away a one year subscription to Infragistics Ultimate valued at $1,995 USD. Simply subscribe to my channel, like the video, and leave a comment to be entered. Winners are announced in the next video in the series.

Official contest rules: https://brianlagunas.com/desktop-to-web-series-youtube-official-contest-rules/

The Prize: https://www.infragistics.com/products/ultimate

Follow Me:
Twitter: https://twitter.com/brianlagunas
Blog: https://brianlagunas.com
GitHub: https://github.com/brianlagunas

My Prism Project:
Prism Library: http://prismlibrary.github.io/
Become a Patron: https://www.patreon.com/prismlibrary

Brian Lagunas

View all posts

Follow Me

Follow me on Twitter, subscribe to my YouTube channel, and watch me stream live on Twitch.