So I have a directive that can either be an attribute, or an element. When it's an attribute, I don't want to load any template inside the existing element it's been declared on. When it's an element, I want to load a given template and populate the directive's custom tag.
I've tried:
return {
link: function(){...},
templateUrl: function(element, attrs){
url = "path/to/directive/template.html";
// Checking if directive is used as an attribute here
if(angular.isDefined(attrs.myDirective)){
url = null; // Tried false, empty string, etc. but angular not happy with any of it
}
return url;
}
}
Any idea how to achieve this?