Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Random post linking functions execution - not in reverse order as documented #8631

Closed
@yogeshgadge

Description

@yogeshgadge

Scenario

Nested Directives with postLink functions using templateUrl instead of inline template.

Expectations

Post link functions of directives should execute in the order reverse to the DOM traversal i.e. post Link function of an outer/parent directive should execute after the postLink function of inner/child directive. Also note that require: '^outer' states the parent.

Symptom/defect

Sequence
---- Expected START --- controller - outer -----
---- Expected END --- postlink - outer ----- 💔 (should be at the end )
-- controller - inner1
---- controller - inner2
---- postlink - inner2
(inner2 pushed)
---- controller - inner2
---- postlink - inner2
(inner2 pushed)
---- postlink - inner1
(inner1 pushed)

High level conclusion

When using templateUrl postLink function will NOT execute as documented.
Is this a defect or we need to update the documentation ?

This is in relation to stackoverflow - post-link-execution-order

The issue occurs when you use templateUrl rather transclude.

This plunker-with templateUrl shows the issues. You have hit refresh or Stop/Run a few times before you see the step ---- Expected END --- postink outer-- seen out of sequence. This should be always be seen at the end as it should be executed at then end being the post link function of the outer directive.

[Plunker with inlined template0(http://embed.plnkr.co/V79NDs4xQSGAsFlSrwPX/preview) which does not seem to reproduce the problem no matter how many times we refresh the page /soft reload (i.e. hit enter in the browser location bar).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions