Skip to main content

Posts

Angular interview questions part 1

 1)Explain component life cycle? Angular application goes through an entire set of processes or has a lifecycle right from its initiation to the end of the application. The representation of lifecycle in pictorial representation as follows, The description of each lifecycle method is as below, ngOnChanges: When the value of a data bound property changes, then this method is called. If no property then no call. ngOnInit: This is called whenever the initialization of the directive/component after Angular first displays the data-bound properties happens. ngDoCheck: This is for the detection and to act on changes that Angular can't or won't detect on its own. Called immediately after  ngOnChanges()  on every change detection run, and immediately after  ngOnInit()  on the first run. ngAfterContentInit: This is called in response after Angular projects external content into the component's view. Called once after the first ngDoCheck(). ngAfterContentChecked: This is c...

Angular start 2

 Module in Angular: Modules are logical boundaries in your application and the application is divided into separate modules to separate the functionality of your application. Let's take an example of app.module.ts root module declared with @NgModule decorator as below, import { NgModule }      from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent }  from './app.component'; @NgModule ({    imports:      [ BrowserModule ],    declarations: [ AppComponent ],    bootstrap:    [ AppComponent ],    providers: [] }) export class AppModule { } The NgModule decorator has five important(among all) options The imports option is used to import other dependent modules. The BrowserModule is required by default for any web-based angular application The declarations option is used to define components in the respective module The bootstrap option tells Angular which...