Angular - DirectivesWhat is the primary purpose of an Angular directive?ATo create new Angular modulesBTo add or change behavior on HTML elementsCTo define routes in the applicationDTo manage HTTP requestsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand what directives doDirectives in Angular are used to add or change behavior on HTML elements, such as changing styles or responding to events.Step 2: Compare with other Angular featuresModules organize code, routes manage navigation, and HTTP requests handle data fetching, which are not the main roles of directives.Final Answer:To add or change behavior on HTML elements -> Option BQuick Check:Directive purpose = Add/change behavior [OK]Quick Trick: Directives change element behavior, not app structure [OK]Common Mistakes:Confusing directives with modulesThinking directives manage routingAssuming directives handle HTTP
Master "Directives" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Modules - Declarations, imports, and exports - Quiz 3easy Component Interaction - @Output decorator with EventEmitter - Quiz 3easy Component Interaction - ng-content for slot-based composition - Quiz 3easy Components - Inline vs external styles - Quiz 11easy Lifecycle Hooks - ngOnDestroy for cleanup - Quiz 8hard Lifecycle Hooks - ngOnDestroy for cleanup - Quiz 10hard Pipes - Built-in pipes (date, currency, uppercase) - Quiz 15hard Templates and Data Binding - Template expressions and statements - Quiz 7medium Templates and Data Binding - Why data binding matters - Quiz 9hard TypeScript in Angular - Why TypeScript is required in Angular - Quiz 1easy