Angular1 Ng Repeat

angular1

// Angular 1 - ng-repeat directive:

app.controller('MainController',[function() {
  this.car = [
    {make: 'Mazda', model: 'Miata', year: 2001},
    {make: 'Toyota', model: 'Prius', year: 2013}
  ]
}]);

<body ng-controller="MainController as main">
  <div>
    <ul ng-repeat="car in main.cars">
      <li>{{car.make}}</li>
      <li>{{car.model}}</li>
      <li>{{car.year}}</li>
    </ul>
  </div>
</body>

In the above code, we use the "controller as" syntax, and we specify the 
ng-repeat directive on the UL element, so the UL element is the one that are 
going to be repeated.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License