I am trying to get the attributes of "abc" defined as custom directive in angularjs:
<div abc="user">
Access granted!
</div>
and then change the text inside div using custom directive:
.directive('abc', function() {
var attr;
return {
link: function (scope, element, attributes) {
attr = attributes.abc;
console.log(attr);
},
template: "" + attr
};
});
The result should be 'user' but it is undefined as attr is not defined at the time template is executed. So, any possible help how to tackle this issue?