I read about ng-attr
for directive, but I want to send array of attributes to directive as example:
<myElement attributes="attributes"></myElement>
And my directive as example:
myApp.directive('myElement', function(){
return {
restrict: 'E',
require: 'ngModel',
template: '<div>' +
'<!-- I want to add this attributes on the div element>' +
'</div>',
replace: true,
scope: {
attributes: '=attributes'
},
}
});
And the attributes is in controller as the following:
$scope.attributes = {"class": "test", "id": "test", "style": "color: 'red'"}
So, How can I set array of attributes in element in directive ?