I need to read the value of an attr in the templateUrl function of my directive.
<my-dirc type="type"></my-dirc>
my-dirc :
return {
scope : {
type : =
},
templateUrl: function(elem, attrs) {
console.log(attrs.type);
}
}
however, the console return "type" only and not the value of type. i have also tried doing
<my-dirc type="{{type}}"></my-dirc>
my-dirc :
return {
scope : {
type : @
},
templateUrl: function(elem, attrs) {
console.log(attrs.type);
}
}
Now the console.log gives me {{type}}.
How can I get the value of type?