Добавить
Уведомления

Angular video series - #2 Lifecycle hooks explained

Lifecycle hooks are a special functionality in Angular that allow us to “hook into” and run code at a specific lifecycle event of a component or directive. You can look at them as phases of component life like every living being has. They get born, they change, they grow and eventually they die. With lifecycle hooks, we can gain better control of our application. When do we use them? For example if you want to fetch some data and display it in your component, you will do that inside of ngOnit lifecycle when component gets initialized, or if you need to cleanup your component, remove some subscriptions you might have to prevent memory leaks you will do that in ngOnDestory lifecycle hook, just before component gets destroyed. 0:00 Intro 0:25 When to use them? 1:00 Implementing ngOnInit 1:50 Implementing ngOnDestroy ************************************************************ Previous Video: https://youtu.be/9IufyZ0G0qg Next video: https://youtu.be/MpfxHnRfrVo Full series: https://youtube.com/playlist?list=PLjsBk8SIQEi-RqkglLcn19TaeeopcuDXV ************************************************************ Linkedin: link https://www.linkedin.com/in/slobodan-gajic/ Portfolio: https://bobangajicsm.github.io/portfolio/ Twitter: https://twitter.com/_SlobodanGajic_ ************************************************************

Иконка канала Понятный JS
13 подписчиков
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

Lifecycle hooks are a special functionality in Angular that allow us to “hook into” and run code at a specific lifecycle event of a component or directive. You can look at them as phases of component life like every living being has. They get born, they change, they grow and eventually they die. With lifecycle hooks, we can gain better control of our application. When do we use them? For example if you want to fetch some data and display it in your component, you will do that inside of ngOnit lifecycle when component gets initialized, or if you need to cleanup your component, remove some subscriptions you might have to prevent memory leaks you will do that in ngOnDestory lifecycle hook, just before component gets destroyed. 0:00 Intro 0:25 When to use them? 1:00 Implementing ngOnInit 1:50 Implementing ngOnDestroy ************************************************************ Previous Video: https://youtu.be/9IufyZ0G0qg Next video: https://youtu.be/MpfxHnRfrVo Full series: https://youtube.com/playlist?list=PLjsBk8SIQEi-RqkglLcn19TaeeopcuDXV ************************************************************ Linkedin: link https://www.linkedin.com/in/slobodan-gajic/ Portfolio: https://bobangajicsm.github.io/portfolio/ Twitter: https://twitter.com/_SlobodanGajic_ ************************************************************

, чтобы оставлять комментарии