Other life cycle events
Besides the init
, changes
, and destroy
events, we can hook four more component life cycle events:
AfterContentInit
: This is called after the component's content is fully initializedAfterContentChecked
: This is called after each time the component is checkedAfterViewInit
: This is called after the component's view has initializedAfterViewChecked
: This is called after the component's view has been checked
Each of them can be implemented in the same way as the previous examples.
Get Angular 2 Components now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.