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.

Isolated scope properties are not available in 'pre' link function when using 'templateUrl' #2064

Closed
@dana-shalev

Description

@dana-shalev

I have an isolated directive which initializes its scope properties in the directive.scope attribute. In the pre link function I'm using those scope attributes.
However, I discovered that if i used 'templateUrl' instead of 'template' in my directive suddenly things stop working.

Apparently when I switched to use 'templateUrl' suddenly the 'pre' link function was called before the scope was initialized with the properties I defined in the directive.scope property.

Take a look at this plunker for an example:

  • The message directive defines an isolated scope which has a message property taken from the attribute.
  • When I print to the console the value of message from the pre function I get undefined (while in the post function I get the actual value).
  • If I comment the templateUrl property and use template instead the pre function will also print the actual value.

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