0
0
Angularframework~10 mins

Event binding with parentheses in Angular - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to bind a click event to the button.

Angular
<button [1]="onClick()">Click me</button>
Drag options to blanks, or click blank then click option'
A[click]
B(click)
C{click}
D<click>
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of parentheses for event binding.
Using curly braces or angle brackets which are invalid.
2fill in blank
medium

Complete the code to call the submitForm method when the form is submitted.

Angular
<form [1]="submitForm()">...</form>
Drag options to blanks, or click blank then click option'
A{submit}
B[submit]
C(submit)
D<submit>
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets which are for property binding.
Using curly braces or angle brackets which are invalid.
3fill in blank
hard

Fix the error in the event binding to call handleClick on button click.

Angular
<button [1]="handleClick()">Click</button>
Drag options to blanks, or click blank then click option'
A(click)
B<click>
C{click}
D[click]
Attempts:
3 left
💡 Hint
Common Mistakes
Using property binding brackets instead of event binding parentheses.
Omitting parentheses after the method name.
4fill in blank
hard

Fill both blanks to bind a keydown event and call onKeydown method.

Angular
<input [1]="[2]()">
Drag options to blanks, or click blank then click option'
A(keydown)
BonKeydown
C(keyup)
DhandleKey
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong event name like keyup.
Using a method name that doesn't match the event.
5fill in blank
hard

Fill all three blanks to bind a mouseenter event, call onMouseEnter, and pass the event object as $event.

Angular
<div [1]="[2]([3])">Hover me</div>
Drag options to blanks, or click blank then click option'
A(mouseenter)
BonMouseEnter
C$event
D(mouseover)
Attempts:
3 left
💡 Hint
Common Mistakes
Using (mouseover) instead of (mouseenter).
Not passing the event object $event.