Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

docs: life-cycle - directives support "VIEW" lifecycle hooks, the docs say they dont #10221

Copy link
Copy link
@shlomiassaf

Description

@shlomiassaf
Issue body actions

I'm submitting a ... Hard to say....

Current behavior

  • ngAfterContentInit
  • ngAfterContentChecked
  • ngAfterViewInit
  • ngAfterViewChecked

Fire on directives.

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...

cebor, kmolerov, nicolashenry and leviathanbadger

Metadata

Metadata

Assignees

No one assigned

    Labels

    freq1: lowhelp wantedAn issue that is suitable for a community contributor (based on its complexity/scope).An issue that is suitable for a community contributor (based on its complexity/scope).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.