filmov
tv
Angular Life Cycle Hook #Part3 | content vs view (Tutorial 43)
Показать описание
This is part-3 on Angular Life Cycle Hook and will talk about ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit and ngAfterViewchecked Life Cycle hook in details.
Support my channel by like, share and subscribe so that I can reach to wider audience and can help them :) :)
*Checkout other videos on Life Cycle Hook:*
Life Cycle hook Part-1:
Life Cycle hook Part-2:
ng-Content
ContentChild and ContentChildren
ViewChild and ViewChildren
Content Vs View
View
Before we go into these hooks, it's important to understand the difference between Content and View.
AfterContentInit and AfterContentChecked are hooks that deal with content, while AfterViewInit and AfterViewChecked are hooks that deal with views.
Content
Content refers to the external content injected into this component using the Content Projection.
Content projection is a way to pass the HTML content from the parent component to the child component. The child component will display the template in a designated spot. We use the ng-content element to create a spot in the template of the child component
View.
View refer to the the template of the component.
ngAfterContentInit
The AfterContentInit is the Life cycle hook that angular calls after the Component’s content has been fully initialized and injected into Components View.
Angular also updates the properties decorated with the ContentChild and ContentChildren before raising this hook.
Angular calls this hook even if there is no projected content in the component
This hook fires after the ngDoCheck hook.
Fires only once, during the first change detection cycle, immediately after the creation of the component.
ngAfterContentChecked
AfterContentChecked is the life cycle hook, that angular calls during every change detection cycle after Angular completes the checking of the content for changes.
Angular also updates the properties decorated with the ContentChild and ContentChildren before raising this hook.
This hook fires after the ngDoCheck & AfterContentInit.
ngAfterViewInit
A lifecycle hook that Angular calls during the change detection after it completes initialization of component’s view and its child views.
Angular also updates the properties decorated with the ViewChild & ViewChildren properties before raising this hook.
Use this hook to handle any additional initialization tasks.
Fires only once, during the first change detection cycle, immediately after the creation of the component.
ngAfterViewChecked
A lifecycle hook that Angular calls after the change detector completes the checking of a component’s view and child views for changes.
Angular also updates the properties decorated with the ViewChild & ViewChildren properties before raising this hook.
I believe you will like this video, Please comment , like and share this video :)
Checkout other important topics :
#angular #angularTutorial #nishasingla
Support my channel by like, share and subscribe so that I can reach to wider audience and can help them :) :)
*Checkout other videos on Life Cycle Hook:*
Life Cycle hook Part-1:
Life Cycle hook Part-2:
ng-Content
ContentChild and ContentChildren
ViewChild and ViewChildren
Content Vs View
View
Before we go into these hooks, it's important to understand the difference between Content and View.
AfterContentInit and AfterContentChecked are hooks that deal with content, while AfterViewInit and AfterViewChecked are hooks that deal with views.
Content
Content refers to the external content injected into this component using the Content Projection.
Content projection is a way to pass the HTML content from the parent component to the child component. The child component will display the template in a designated spot. We use the ng-content element to create a spot in the template of the child component
View.
View refer to the the template of the component.
ngAfterContentInit
The AfterContentInit is the Life cycle hook that angular calls after the Component’s content has been fully initialized and injected into Components View.
Angular also updates the properties decorated with the ContentChild and ContentChildren before raising this hook.
Angular calls this hook even if there is no projected content in the component
This hook fires after the ngDoCheck hook.
Fires only once, during the first change detection cycle, immediately after the creation of the component.
ngAfterContentChecked
AfterContentChecked is the life cycle hook, that angular calls during every change detection cycle after Angular completes the checking of the content for changes.
Angular also updates the properties decorated with the ContentChild and ContentChildren before raising this hook.
This hook fires after the ngDoCheck & AfterContentInit.
ngAfterViewInit
A lifecycle hook that Angular calls during the change detection after it completes initialization of component’s view and its child views.
Angular also updates the properties decorated with the ViewChild & ViewChildren properties before raising this hook.
Use this hook to handle any additional initialization tasks.
Fires only once, during the first change detection cycle, immediately after the creation of the component.
ngAfterViewChecked
A lifecycle hook that Angular calls after the change detector completes the checking of a component’s view and child views for changes.
Angular also updates the properties decorated with the ViewChild & ViewChildren properties before raising this hook.
I believe you will like this video, Please comment , like and share this video :)
Checkout other important topics :
#angular #angularTutorial #nishasingla
Комментарии