angularjs - Get the html element form $scope, that ng-repeat created from $scope? -


is possible html element (for styling) $scope object?

i'm using ng-repeat on $scope.array , know $scope.array[0] corresponds first element in html created ng-repeat, possible html element itself through $scope in javascript?

you can attach controller each element , inject $element access each element way. like:

html:

<li ng-repeat="item in items" ng-controller="itemcontroller"></li> 

javascript:

module.controller('itemcontroller', ['$scope', '$element', function($scope, $element) {     // use $element here }]); 

however, if want change styling of each element, should consider using ng-class on each item, , specifying class $scope of each item.

if want dom manipulation, it's recommended within directive.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -