5

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);
1
  • 1
    for future reference, you are going to get more people looking at your question if you include the javascript tag. Commented Sep 13, 2013 at 19:40

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.