I have HTML code:
<div dynamic="html"></div>
And Angular JS in AJAX response:
$scope.html = content;
My dirrective dynamic looks as:
.directive('dynamic', function ($compile) {
return {
restrict: 'A',
replace: true,
link: function (scope, ele, attrs) {
scope.$watch(attrs.dynamic, function(html) {
ele.html(html);
$compile(ele.contents())(scope);
});
}
};
})
So, when I have $scope.html with HTML code in response then dynamic does not insert(prepend) this code in div block. Why?
template? See the example under Template-extending directive