How to avoid inheritance using Directive composition in Angular 15

  Рет қаралды 994

JS Frameworks

JS Frameworks

Күн бұрын

Пікірлер: 3
@SergeyDziadevich
@SergeyDziadevich Жыл бұрын
awesome, thanks
@tomcionek15
@tomcionek15 Жыл бұрын
Using ngOnDestroy in base classes of components is very unsafe. You should remember in all components that component can't use ngOnDestroy, because method will be overrided and then subscriptions will not be detached. Subscriptions should be destroyed in parents component, not base class. Second solution is programming in SOLID way - create service which is responsible for special behavior, and this service should be with destroy(): void public method. Then in parent component in ngOnDestroy you will use this method to destroy subscriptions in that method. Third solution is use second solution with services provided in Components. This is letting us to use ngOnDestroy in that services, so we don't need to share destroy() method and just implement ngOnDestroy in that services.
@JSFrameworks
@JSFrameworks Жыл бұрын
Thanks for sharing
Improve build performance of Angular 15 using esbuild
4:20
JS Frameworks
Рет қаралды 3,2 М.
Angular Signals overview - Angular 16
23:34
JS Frameworks
Рет қаралды 682
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 19 МЛН
when you have plan B 😂
00:11
Andrey Grechka
Рет қаралды 59 МЛН
1ОШБ Да Вінчі навчання
00:14
AIRSOFT BALAN
Рет қаралды 6 МЛН
How To Make Angular Code More Reusable
19:14
Decoded Frontend
Рет қаралды 29 М.
Higher-Order Components Are Misunderstood In React
17:38
Jan Hesters
Рет қаралды 1,2 М.
Why I decided to switch to the inject() function in Angular
6:10
Joshua Morony
Рет қаралды 57 М.
Introducing the Directive Composition API in Angular v15
4:27
Use Webpack public path runtime variable in Angular application
6:07
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12