Directive for Angular 1.x for dynamic element attributes
Somewhat similar to ng-class but for attributes.
Given:
angular
.module('myApp')
.component('myComponent', {
template: '<div ng-attr="{ \'special-attribute\': $ctrl.attrValue }"></div>',
controller: function() {
this.attrValue = 'Hello gurls';
}
});will be compiled to
<div ng-attr="{ 'special-attribute': $ctrl.attrValue }" special-attribute="Hello gurls"></div>npm i ng-attr --saveangular.module('yourModule', ['argshook.ngAttr'])