Angular - DirectivesWhich of the following is the correct syntax to apply a directive in Angular?ABCDCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify Angular directive syntaxStructural directives use the asterisk (*) before the directive name to modify the DOM structure.Step 2: Check other symbols# is for template references, ? and @ are invalid for directives.Final Answer:<div *myDirective></div> -> Option CQuick Check:Structural directives use * prefix = A [OK]Quick Trick: Look for * before directive name for structural directives [OK]Common Mistakes:Using # which is for template referencesUsing ? or @ which are invalid syntaxOmitting the * for structural directives
Master "Directives" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Fundamentals - Angular project structure walkthrough - Quiz 14medium Component Interaction - @ContentChild and content projection - Quiz 6medium Components - Creating components with CLI - Quiz 5medium Directives - Structural vs attribute directives - Quiz 8hard Directives - *ngIf for conditional rendering - Quiz 6medium Directives - *ngFor for list rendering - Quiz 15hard Directives - Structural vs attribute directives - Quiz 7medium Templates and Data Binding - Template expressions and statements - Quiz 12easy Templates and Data Binding - Two-way binding with ngModel - Quiz 4medium TypeScript in Angular - Enums in Angular applications - Quiz 13medium