I have a directive highlight with a data-highlight attribute that I want to use inside the directive, but I can´t get it inside the directive.
HTML:
<li ng-repeat="car in cars" data-highlight="{{car.id}}">
Directive:
app.directive('highlight', function() {
function link(scope, element, attrs) {
console.log("highLight directive initialized");
console.log("id=" + attrs.highlight);
var id = 1;
var iw = angular.element(document.querySelector('#iw-' + id));
console.log("iw=" + iw);
}
return {
link: link,
controller: function($scope, $element) {
console.log("highLight directive CONTROLLER initialized");
}
};
})
Please see this plunker: https://plnkr.co/edit/dP2cvut4f5ao5pFe6ka0?p=preview
Note: AngularJs version is 1.0.7
myAtrributeCustomthen in htmlmy-attribute-custom="{{car.id}}"