This is the directive that I wanna build:
module.directive('templater', function () {
return {
restrict: 'A',
replace: true,
templateUrl: function (element, attrs) {
return attrs.templater;
}
};
});
but, as you may know, in this HTML:
<div
ng-repeat="item in items"
templater="item.template">
</div>
accessing attrs.templater
simply gives item.template
instead of the actual template url string.
How do you access the data inside attrs.templater
without going inside the linking function?
I want to leverage the simplicity of the templateUrl
function, also, avoid the reflow overhead in the linking function.