Update: I found this
<http://www.beyondjava.net/blog/angularjs-2-0-sneak-preview-data-binding/>,
which shows to use [inner-html]. This works for simple HTML, but doesn't
work to inject custom Angular directives I'm created and included like so:
@View({
templateUrl: '/pages/study.html',
directives: [Multiselect]
})
I'm sure there's something special I need to do to allow injected HTML to
use custom directives, I just have no idea what. (Some sort of equivalent
of $compile in old Angular, perhaps?) My old Angular 1.x code used this to
compile injected HTML elements that use Angular:
angular.module('qms')
.directive('bindHtmlCompile', ['$compile', function ($compile) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.$watch(function () {
return scope.$eval(attrs.bindHtmlCompile);
}, function (value) {
// Incase value is a TrustedValueHolderType, sometimes it
// needs to be explicitly called into a string in order to
// get the HTML string.
element.html(value && value.toString());
// If scope is provided use it, otherwise use parent scope
var compileScope = scope;
if (attrs.bindHtmlScope) {
compileScope = scope.$eval(attrs.bindHtmlScope);
}
$compile(element.contents())(compileScope);
});
}
};
}]);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.