How do I get jQuery to access elements with a class that was given by Angular in an ng-repeat
loop?
(If I execute the same jQuery command $('.active').css('color','red');
in the console of Firebug, it works.)
<!DOCTYPE html>
<html ng-app="mainModule">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<div ng-controller="mainController">
<div class="active">aaa</div>
<div class="active">bbb</div>
<div ng-repeat="project in projects">
<div class="active">{{project}}</div>
</div>
</div>
<script>
angular.module('mainModule', [])
.controller('mainController', function ($scope) {
$scope.projects = ['111', '222', '333', '444'];
$('.active').css('color','red');
});
</script>
</body>
</html>