I have meta application written in Angular.js and I can create apps using Angular but with some limitations. I can use and create directives and create page that are automaticaly added to $route.
I need directive widget
that will use other page as template but the page url need to be dynamic (based on attribute) <widget name="page"/>
will include template using name
attribute, here is my code:
return {
restrict: 'EA',
replace: true,
transclude: true,
compile: function(tElement, tAttrs, transclude) {
this.templateUrl = $route.routes['/<APP-NAME>/' + tAttrs.name].templateUrl;
}
};
I was thinking that maybe I can use $http to fetch the template, but can I return promise from compile function and how to replace the template?