Best series and explanation after watching so many videos for angular lifecycle. Thanks for your work.
@sagarvyas55273 ай бұрын
Best angular series ever got in my 2 year of experience but dont know why people are not hitting like button. Tq so much sir.
@sona4612 Жыл бұрын
Best tutorial 🔥🔥🔥
@Moath2688 ай бұрын
thanks
@phoupygnasak6160 Жыл бұрын
First of all, awesome video series with simple to understand walkthroughs. Question, are there reasons why you couldn't just use ngDoCheck hook for all detection changes instead of the specific ones, e.g. ngAfterContentChecked, and the other Checked hooks? If doCheck runs every time there is an event, why would you want to implement the other checked hooks. What is the benefit of using each specific check and not just DoCheck?
@sona4612 Жыл бұрын
I also have this doubt
@david-hasselhoff7483 Жыл бұрын
I do believe the answer to be the following: 1. At the time ngDoCheck runs, the ng-content might not be defined yet. 2. ngDoCheck runs more frequently, namely during every ChangeDetection Cycle (which is all the time). ngAfterContentChecked only runs when the ng-content has changed. Hence it is more efficient to use this lifecycle hook.
@Fr0z3nRebel Жыл бұрын
When ngDoCheck is run, projected content is not yet available (unless the content has already been initialized and has not yet changed since the last render)
@phoupygnasak6160 Жыл бұрын
@@david-hasselhoff7483 if doCheck runs, doesn't this lifecycle always run on any change anyways? So for example, assume the content has been initialized; now if Angular detects a content change - doesn't ngDoCheck run, then afterwards ngAfterContentChecked; resulting in at least two lifecycle operations for the change? If this is true, why does angular require the doCheck life-cylce hook? The assumption I can make out of this is that the doCheck object / method contains the objects of these lifecycle hooks for comparison under the hood... so maybe it needs to run doCheck first in order to compare / detect the changes of Lifecycle hooks / objects it encapsulates ... I'm not sure, but your explanation does make sense though .. so ty
@someshpanigrahi63549 ай бұрын
Question:- if NgOninit called once then if my parent component assign 3 times of child component then what happen with ngOninit ? I know constructor called 3 times.
@procademy9 ай бұрын
NgOnOnit will be called everytime a comonent is initialised, just like constructor. So, in your example it will be called three times.