I have a directive in isolated scope and i define a couple of variables in link function of the directives so the template fails to bind to these variables but templateUrl seems to bind to these variables easily... what is the reason for this?
mymodule.directive("directive1", function () {
return {
require: '^widget',
// template: '<div><h1 > {{editMessage}}</h1></div>',
templateUrl: "dummy.htm",
scope: {
},
link: function (scope, element, attrs) {
scope.editMessage = "Click to edit";
});
}
});
my dummy.htm has the same piece of code as in template contents:-
<div><h1 > {{editMessage}}</h1></div>
the binding happens when i use templateUrl but not when i use template why is it so? is the execution flow different for both of these?
<div><h1 > {{editMessage}}</h1></div>
– Chandermani