Life Cycle function of angular components

angular in the life cycle:

 When the component is loaded, the order lifecycle functions:

00 - constructor: constructor is executed first, generally used to initialize variables, should not do other things

01 - ngOnChanges: execution when the input value is bound property changes, the father and son pass the value of the components automatically when called. Attribute value change is not input, the function is not performed

02 - ngOnInit: executes initialization commands and components performed only once. Usually the request data on the function

03 - ngDoCheck (): executed when the property value is bound to change, such as two-way data binding, change attributes, which will trigger

04 - ngAfterContentInit (): After the content projected onto the component calls executed only once

05 - ngAfterContentChecked (): projection component content calls after the change occurs, is performed after ngDoCheck ()

06 - ngAferViewInit (): component view and a rear view of the sub-loading completion call, DOM operation in the process

07 - ngAfterViewChecked (): Components and child views changed after the call, each ngAfterViewInit () or ngAfterContentInit call (after)

08 - ngOnDestroy (): the destruction of the component calls

 

Guess you like

Origin www.cnblogs.com/monkey-K/p/11594160.html