A. The click event should call increment() with parentheses
B. The count variable is not initialized
C. The selector is missing standalone: true
D. Template syntax is invalid for interpolation
Solution
Step 1: Check event binding syntax
The template uses (click)='increment' but should call the method with parentheses: (click)='increment()'.
Step 2: Verify other parts
Count is initialized, selector is valid without standalone, and interpolation syntax is correct.
Final Answer:
The click event should call increment() with parentheses -> Option A
Quick Check:
Event binding needs method call syntax [OK]
Hint: Use parentheses to call methods in event bindings [OK]
Common Mistakes:
Omitting parentheses in event handler calls
Thinking count needs explicit initialization
Confusing standalone component requirement
5. You want to create an Angular component that shows a list of items and highlights the selected item. Which approach best uses Angular's core concepts?
hard
A. Use a global variable outside Angular and update the DOM manually with JavaScript
B. Use a standalone component with a signal to track selected item and a template with a loop and conditional class binding
C. Create multiple components for each item without sharing state
D. Use only CSS to highlight items without any Angular logic
Solution
Step 1: Identify Angular best practices
Angular encourages using standalone components, signals for reactive state, and template directives like loops and conditional classes.
Step 2: Evaluate options
Use a standalone component with a signal to track selected item and a template with a loop and conditional class binding uses Angular features properly; A bypasses Angular, C lacks shared state, D ignores logic needed for selection.
Final Answer:
Use a standalone component with a signal to track selected item and a template with a loop and conditional class binding -> Option B
Quick Check:
Angular reactive state + template logic = Use a standalone component with a signal to track selected item and a template with a loop and conditional class binding [OK]
Hint: Use signals and template loops for interactive lists [OK]
Common Mistakes:
Manipulating DOM outside Angular
Not sharing state between items
Relying only on CSS without logic
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.