Recall & Review
beginner
What does event binding with parentheses
(event) do in Angular?It listens for a user action like a click or key press and runs a function when that event happens.
Click to reveal answer
beginner
How do you write a click event binding in Angular template?
Use
(click)="yourFunction()" inside an element tag to run yourFunction when clicked.Click to reveal answer
beginner
Why use parentheses around event names in Angular templates?
Parentheses tell Angular to listen for that event and call the specified method when it happens.
Click to reveal answer
intermediate
Can you pass event data to the function in Angular event binding?
Yes, use
$event inside the function call to access event details like mouse position or key pressed.Click to reveal answer
beginner
What happens if you forget parentheses in Angular event binding?
Angular will not treat it as an event listener, so your function won’t run on the event.
Click to reveal answer
In Angular, how do you bind a button click to a method named
submitForm?✗ Incorrect
Parentheses ( ) are used for event binding in Angular, so (click)="submitForm()" is correct.
What does
$event represent in Angular event binding?✗ Incorrect
$event holds the event details like mouse position or key pressed.Which of these is NOT a valid Angular event binding syntax?
✗ Incorrect
Square brackets [ ] are for property binding, not event binding. Events use parentheses ( ).
If you want to run a method when a user presses a key, which event do you bind?
✗ Incorrect
The
keydown event triggers when a key is pressed.What will happen if you write
click="doSomething()" without parentheses in Angular?✗ Incorrect
Without parentheses, Angular does not treat it as an event binding, so the function won’t run on click.
Explain how event binding with parentheses works in Angular and why it is important.
Think about how you tell Angular to react when a user clicks a button.
You got /4 concepts.
Describe how to pass event data to a method using Angular event binding.
Remember the special variable Angular provides for event info.
You got /3 concepts.