javascript - How to Get Html Element Attributes in AngularJS? -


edit: went on kinds of tangents, question remains - how attribute of html element inside angular controller?

here plnkr attempt: http://plnkr.co/edit/0vmefamenc0xeqwjilhm?p=preview

    //$scope.myelem = angular.element('testdiv'); //this breaks angular     $scope.myelem = $document.find('testdiv'); //this doesn't break angular, unclear returns     $scope.myattr = $scope.myelem.name; //this returns nothing 

if need convincing necessary - need find when user scrolls through div, shown here: http://jsfiddle.net/rs3prkfm/ note has nothing question, scenario. question simple - how attribute's value?

references:
useless official docs: https://docs.angularjs.org/api/ng/function/angular.element
useful link still doesn't work: http://mlen.io/angular-js/get-element-by-id.html

you use element api https://docs.angularjs.org/api/ng/function/angular.element

there should few occasions need it, though.


Comments