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
Description
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 amessage
property taken from the attribute. - When I print to the console the value of
message
from thepre
function I get undefined (while in thepost
function I get the actual value). - If I comment the
templateUrl
property and usetemplate
instead thepre
function will also print the actual value.