use strict app directive dynamic function compile return restrict repl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
'use strict';
app.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);
});
}
};
});