Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, April 17, 2015

Codecademy ng-repeat I


//sample solution to MainController.js

app.controller('MainController',
['$scope', function($scope) {
  $scope.title = 'My Own String';
  $scope.promo = 'Your Own String';
  $scope.products =
  [
    {
      name: 'The Book of Trees',
      price: 19,
      pubdate: new Date('2014', '03', '08'),
      cover: 'img/the-book-of-trees.jpg'
    },
    {
      name: 'Program or be Programmed',
      price: 8,
      pubdate: new Date('2013', '08', '01'),
      cover: 'img/program-or-be-programmed.jpg'
    }
  ] 
}]);

<!-- sample solution for a portion of index.html -->

<div ng-repeat="product in products" class="col-md-6">
  <div class="thumbnail">
    <img src="img/the-book-of-trees.jpg">
    <p class="title">{{ product.name }}</p>
    <p class="price">{{ product.price | currency }}</p>
    <p class="date">{{ product.pubdate | date }}</p>
  </div>
</div>

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts