#39 ngOnChanges Lifecycle Hook | Lifecycle Hooks in Angular | A Complete Angular Course

preview_player
Показать описание
In this lecture you will learn about first lifecycle hook in Angular which gets called after the component is initialized. This lifecycle hook is ngOnChanges hook, which gets called every time the input property of a component changes. Let's understand ngOnChanges lifecycle hook with some practical example.

Рекомендации по теме
Комментарии
Автор

I think you are the best teacher(by God) of Angular lecture. I loved your teaching.

subaratatubebd
Автор

Such a detailed videos.. thank you sir🔥🔥

Am still wondering how the likes are very less for these awesome videos..

sona
Автор

what a beautifully explained.
Thanks for your nice explanation with change detection to ngOnChanges- this same question asked in many interviews with practical examples.
It's really helpful.
We need concepts understanding but the most important point is useCase when and where to use in project requirement.
That's what we got here.
Susbcribed.
Keep growing.

sanatanShishya
Автор

Sir, I found two cases - Please correct me

Case I
Statement: Whenever a variable related to input-bound properties in the parent component is updated, the ngOnChanges() lifecycle hook of the child component is executed.

Explanation: When a parent component updates a property that is bound to an input property of a child component, Angular detects this change and calls the ngOnChanges() lifecycle hook in the child component. This hook receives a SimpleChanges object containing the current and previous values of the input-bound properties.

Case II
Statement: Whenever a variable related to input-bound properties in the child component is updated, the ngOnChanges() lifecycle hook of the child component is not executed.

Explanation: The ngOnChanges() lifecycle hook is triggered only by changes to input properties that originate from the parent component. If a property within the child component itself is updated, ngOnChanges() will not be called. This hook is specifically designed to respond to changes from the parent component, not from within the child component.

chanaky
Автор

I’d have loved a demonstration of what happens when there are more than one input, will it get called for each one when the component is initialized and the values are retrieved from the parent or just called once after all inputs are loaded?

_M
Автор

I would greatly appreciate it if you could provide notes under each video's description.

amarreddy
Автор

Sir, can we get notes or something so that one can revise all the topics?

flutterdevfarm