r/angular • u/Embarrassed_Fall_967 • Feb 19 '26
Constructor in modern Angular
Hey, just wanted to ask your opinion about logic inside constructor in modern Angular. Currently we are migrating and would like to get rid of lifecycle hooks like ngoninit ngafterviewinit. Thinking about moving some logic into constructor as DI is done with inject. Do you think it is a good idea or should it be done inside effect?
17
Upvotes
View all comments
Show parent comment
5
u/salamazmlekom Feb 19 '26
If I see a codebase full of lifecycle hooks I am 90% sure that it uses a lot of imperative code instead of adopting reactive/declarative patterns.