Angular - Lifecycle HooksWhich lifecycle hook is called immediately after Angular has initialized all data-bound properties of a component?AngDoCheckBngOnInitCngOnChangesDngAfterViewInitCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the purpose of ngOnInitngOnInit runs once after Angular sets all input properties, perfect for initialization.Step 2: Compare with other hooksngOnChanges runs before ngOnInit if inputs change; ngAfterViewInit runs after the view is initialized; ngDoCheck runs during change detection.Final Answer:ngOnInit -> Option BQuick Check:Initialization hook = ngOnInit [OK]Quick Trick: Initialization after inputs = ngOnInit [OK]Common Mistakes:Confusing ngOnChanges with ngOnInitThinking ngAfterViewInit runs firstAssuming ngDoCheck is for initialization
Master "Lifecycle Hooks" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Fundamentals - Angular CLI installation and setup - Quiz 12easy Component Interaction - @ContentChild and content projection - Quiz 13medium Component Interaction - @Input decorator for parent to child - Quiz 6medium Components - Creating components with CLI - Quiz 7medium Directives - *ngFor for list rendering - Quiz 9hard Lifecycle Hooks - ngOnInit for initialization - Quiz 11easy Templates and Data Binding - Why data binding matters - Quiz 15hard Templates and Data Binding - Two-way binding with ngModel - Quiz 15hard TypeScript in Angular - Type annotations in components - Quiz 3easy TypeScript in Angular - Interfaces for data models - Quiz 2easy