My problem is demonstrated in the below plnkr
<ntimes repeat=10 >
<h1>Hello World - 10 {{smsg}}</h1>
<h4>More text</h4>
</ntimes>
Directive :
directive('ntimes', function() {
return {
restrict: 'E',
scope:{
smsg: '='
},
compile: function(tElement, attrs) {
var content = tElement.children();
for (var i = 0; i < attrs.repeat - 1; i++) {
tElement.append(content.clone());
}
tElement.replaceWith(tElement.children());
return function(scope,elem,attr){
scope.smsg='abc';
}
}
}
})
I have a compile function returning link function, and the directive scope is isolated. When I update scope variable in the link function, the page is not rendering the updated value. I am expecting to see abc instead of xyz.
Please help