Add angular directive allowing elements to bind to html

This commit is contained in:
Kyle Johnson 2014-11-20 04:05:22 +00:00
parent 408c6111b8
commit 92bfac0aad
1 changed files with 10 additions and 0 deletions

View File

@ -33,3 +33,13 @@ ZoneMinder.factory('Console', function($http) {
};
});
ZoneMinder.directive('angularHtmlBind', function($compile) {
return function(scope, elm, attrs) {
scope.$watch(attrs.angularHtmlBind, function(newValue, oldValue) {
if (newValue && newValue !== oldValue) {
elm.html(newValue);
$compile(elm.contents())(scope);
}
});
};
});