Angular - ModulesWhich of the following is the correct way to define an Angular module?Aclass AppModule { @NgModule() }Bmodule AppModule { declarations: [], imports: [] }Cexport function AppModule() { declarations: [] }D@NgModule({ declarations: [], imports: [], bootstrap: [] }) export class AppModule {}Check Answer
Step-by-Step SolutionSolution:Step 1: Recall Angular module syntaxAngular modules use the @NgModule decorator with metadata like declarations and imports.Step 2: Match syntax to optionsOnly @NgModule({ declarations: [], imports: [], bootstrap: [] }) export class AppModule {} correctly uses @NgModule with export class syntax.Final Answer:@NgModule({ declarations: [], imports: [], bootstrap: [] }) export class AppModule {} -> Option DQuick Check:@NgModule decorator syntax [OK]Quick Trick: Look for @NgModule decorator with export class [OK]Common Mistakes:Using 'module' keyword instead of classPlacing @NgModule inside class body incorrectlyDefining module as a function
Master "Modules" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Fundamentals - How Angular bootstraps an application - Quiz 12easy Angular Modules - NgModule decorator and metadata - Quiz 11easy Component Interaction - ng-content for slot-based composition - Quiz 6medium Components - Inline vs external templates - Quiz 3easy Components - Why components are the building blocks - Quiz 5medium Directives - *ngFor for list rendering - Quiz 2easy Directives - *ngFor for list rendering - Quiz 5medium Lifecycle Hooks - ngDoCheck for custom change detection - Quiz 2easy Lifecycle Hooks - ngAfterContentInit for projected content - Quiz 2easy TypeScript in Angular - Decorators as TypeScript feature - Quiz 13medium