angular controller repeat

by Steven Martin

HTML

<div ng-controller="MyCtrl">

    <table>
    <tr ng-repeat="c in candidates.vicePresidents">
        <td>{{c.no}}</td>
        <td>{{c.name}}</td>
    </tr>
</table>

JavaScript

var myApp = angular.module('myApp', []);

function MyCtrl($scope) {

    $scope.candidates = {
  presidents : [
    {
      no:1,
      name:'Brooke Jovi Jon',
      votes:51,
    },
    {
      no:2,
      name:'Cabug-os Jerry',
      votes:23
    },
    {
      no:3,
      name:'Hoorane Nialle',
      votes:25
    }]
  ,
  vicePresidents : [
    {
      no:11,
      name: 'Frank Joemar Timbang',
      votes:20
    },
    {
      no:12,
      name: 'Curtis Zaymond',
      votes:19
    },
    {
      no:13,
      name: 'Reeves Manny',
      votes:21
    }
  ]
};

}