What is the Angular 2 Lifecycle equivalent of $postLink?


I’m currently upgrading from Angular.JS (1.5) to Angular 2+. I have come across as $postLink method in an IComponentController and I’m trying to figure out what the equivalent lifecycle hook is in Angular 2+.


You are most probably looking for ngAfterViewInit which fires after component and all its child components are initialized.

Of course, it depends on your particular use case as with async data loading there might be some discrepancies which might be needed to be handled differently (for example, monitoring async changes on @Input() properties, but that’s another topic).

doc ref:

Answered By – dee zg

Answer Checked By – Dawn Plyler (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.