Angular Interview Questions Flashcards
default modules
Lifecycle hooks
predefined methods in angular that enable developers to access stages of a components life cycle.
beginds with instantiation and rendering of the view and ends with destruction and removal of a component directive from the DOM.
Angular performs change detection throughout lifecycle to update the view and component instance when need.
ngOnChanges
when 1 > more input properties of a component change, this method is invoked.
receives object containing the input properties prior and present values.
NgOnInit
method invoked after component initialization and when the input properties have been set. The ideal place to perform initialization logic that depends on input properties.
ngAfterViewInit
method called once we verify component view has been initialized.
ngAfterViewChecked
This method is called after the component’s view has been checked for changes.
ngOnDestroy
This method is invoked before the component’s destruction. It enables you to perform any cleanup logic necessary
ngDoCheck
We call this method during every change detection cycle of the component. It enables you to custom change detection logic.
ngAfterContentInit
We invoke this method only after the component’s content has been projected into its view.