I'm trying to access an array of objects in my controller :
angular.module('schoolManagement').controller('CycleController', ['$scope', function($scope){
$scope.cycles = [
{
nomCycle : 'Primaire',
active : 'oui'
},
{
nomCycle : 'Collège',
active : 'non'
}
];
console.log($scope.cycles[0].nomCycle);
}]);
The console.log() gives exactly what i'm looking for the in console, but when i use ng-repeat to loop over the array in my view, it doesn't work :
<tbody ng-controller="CycleController as CycleCtrl">
<tr ng-repeat="cycle in CycleCtrl.cycles">
<td>
<input type="checkbox" />
</td>
<td>{{cycle.nomCycle}}</td>
<td>{{cycle.active}}</td>
</tr>
</tbody>
EDIT :
Since i'm using $scope there is no need to use the controller syntax, the correct form in this :
<tr ng-repeat="cycle in cycles">...</tr>