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 }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
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.
I think you are right that this is a bug. Although template loading is asynchronous, it seems that the template has been loaded by the time the pre-link is called and but the set-up of the isolated scope has not occurred.
See this fiddle (http://plnkr.co/edit/n9EEOS1jm7aXIH37XfiF?p=preview) and put break points on the pre and post link functions as well as line 4265 of angular.js
I'm seeing a different, but related bug where scope vars prefixed with @ that are referenced in the link function, when $observed or not, are also undefined, only when using the templateUrl attribute.
I have an isolated directive which initializes its scope properties in the
directive.scope
attribute. In thepre
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:
message
directive defines an isolated scope which has amessage
property taken from the attribute.message
from thepre
function I get undefined (while in thepost
function I get the actual value).templateUrl
property and usetemplate
instead thepre
function will also print the actual value.The text was updated successfully, but these errors were encountered: