I can add a dynamic attribute through the directive, maybe this will help you
myApp.directive('dynAttr', function() { return { scope: { list: '=dynAttr' }, link: function(scope, elem, attrs){ for(attr in scope.list){ elem.attr(scope.list[attr].attr, scope.list[attr].value); }
In the controller
$scope.attArray = [ { attr: 'myattribute', value: '' } ];
Use it like
<input dyn-attrs="attArray"></input>
source share