You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: life-cycle - directives support "VIEW" lifecycle hooks, the docs say they dont #10221
Expected/desired behavior
According to the docs these lifecycle hooks are Components only
ngAfterContentInit
ngAfterContentChecked
ngAfterViewInit
ngAfterViewChecked
The compiler registers them to invoke on directives as well.
The view factory of a component containing a directive will invoke the lifecycle hook on that directive. This is not by change, this is by intent from the compiler as it requires accessing the directive instance and calling the hook within the detectChangesInternal method.
Here's a plunker
I can only assume the docs are incorrect...
Reacted by Felix Itzenplitz, kmolerov, Nicolas HENRY and Brandon Slade
changed the title [-]Directives support "VIEW" lifecycle hooks, the docs say they dont[/-][+]docs: life-cycle - directives support "VIEW" lifecycle hooks, the docs say they dont[/+]on Jun 23, 2017
Activity
tbosch commentedon Oct 4, 2016
ngAfterContentInit/Checkedis also valid for directives, as they can also use@ContentChildren-> docs need to be changed.ngAfterViewInitalso fires for directives so that they can be notified when all components in the template that they are in have been processed.vicb commentedon Oct 6, 2016
Anybody from the community wants to submit a docs PR ?
@shlomiassaf ?
docs(lifecycle-hooks): update event hooks to match directives capabil…
Drumarcco commentedon Nov 17, 2016
@vicb PR submitted 😃
DzmitryShylovich commentedon Feb 3, 2017
@pkozlowski-opensource docs issue
4 remaining items
[-]Directives support "VIEW" lifecycle hooks, the docs say they dont[/-][+]docs: life-cycle - directives support "VIEW" lifecycle hooks, the docs say they dont[/+]sandangel commentedon Nov 7, 2017
5 months to process a docs fix PR ??? And it hasn't been merge yet.
docs(aio): updates directive event hooks real capabilities
docs(aio): updates directive event hooks real capabilities (#16654)
angular-automatic-lock-bot commentedon Sep 13, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
docs(aio): updates directive event hooks real capabilities (angular#1…
docs(aio): updates directive event hooks real capabilities (angular#1…