Answer the question
In order to leave comments, you need to log in
How to render a directive in a controller?
For example, there is a directive
(function() {
angular.module("myDir", []).directive("myDir", myDir);
function myDir() {
return {
restrict: "EA",
templateUrl: "app/components/myDir/myDir.template.html",
};
}
}());
var temp = "<div myDir></div>";
var content = $compile(temp)({});
Answer the question
In order to leave comments, you need to log in
Perhaps the template has not loaded yet, try to check the result in a couple of seconds.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question