Tuesday, July 17, 2018

lifecycle hooks for directives in Angular 5

Page 128 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis suggests that the directives in Angular 5 do not have the ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, and ngAfterViewChecked lifecycle hooks, but otherwise have the hooks for components as listed here. The same page of the book points out that you need to make sense of Inputs at the ngOnInit lifecycle hook of a component when tempted to otherwise do so at the constructor where the Inputs can't yet be read. This isn't new for me, but I also cannot remember if I explicitly mentioned it at this blog so I am bringing it up now.

No comments:

Post a Comment