, 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);
});
}
};
}]);