问题描述:

How do I get DOM element Attributes similar way (outside angular) I get $scope (angular.element(element).scope()) ?

I need this so I can use $animator service on some element that is being inserted into DOM

the part of my code would look like:

var element = $compile(template,scope);

var attrs = ? // I would do element.attrs(),

// but this won't work as it does not perform normalization

var animation = $animator(scope,attrs);

animation.enter(element,parent);

网友答案:

this worked for me so you'll just need to know the attributes you're looking for...

console.log( angular.element(element)[0].getAttribute('class') );

actually this should then work too:

var attrs = angular.element(element)[0].attributes;
相关阅读:
Top