index.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html ng-app="gemStore">
  3. <head lang="en">
  4. <meta charset="UTF-8">
  5. <title>AngularJS Store</title>
  6. <link rel="stylesheet"
  7. type="text/css"
  8. href="../bootstrap/dist/css/bootstrap.min.css"/>
  9. <link rel="stylesheet" type="text/css" href="app.css"/>
  10. <script type="text/javascript" src="../angular/angular.min.js"></script>
  11. <script type="text/javascript" src="app.js"></script>
  12. </head>
  13. <body ng-controller="StoreController as store">
  14. <!-- Products Container -->
  15. <div class="list-group" ng-hide="store.product.soldOut">
  16. <!-- Product container -->
  17. <div class="list-group-item" ng-repeat="product in store.products">
  18. <h3>
  19. {{product.name}}
  20. <em class="pull-right">{{product.price | currency}}</em>
  21. </h3>
  22. <section ng-controller="PanelController as panel">
  23. <ul class="nav nav-pills">
  24. <li ng-class="{ active:panel.isSelected(1) }">
  25. <a ng-click="panel.selectTab(1)">Description</a></li>
  26. <li ng-class="{ active:panel.isSelected(2) }">
  27. <a ng-click="panel.selectTab(2)">Specifications</a></li>
  28. <li ng-class="{ active:panel.isSelected(3) }">
  29. <a ng-click="panel.selectTab(3)">Reviews</a></li>
  30. </ul>
  31. <div class="panel" ng-show="panel.isSelected(1)">
  32. <h4>Description</h4>
  33. <p>{{ product.description }}</p>
  34. </div>
  35. <div class="panel" ng-show="panel.isSelected(2)">
  36. <h4>Specifications</h4>
  37. <p>None yet</p>
  38. </div>
  39. <div class="panel" ng-show="panel.isSelected(3)">
  40. <h4>Reviews</h4>
  41. <blockquote ng-repeat="review in product.reviews">
  42. <b>Stars: {{ review.stars }}</b>
  43. {{ review.body }}
  44. <cite>by: {{ review.author }} on {{ review.createdOn | date }}</cite>
  45. </blockquote>
  46. <form name="reviewForm" novalidate
  47. ng-controller="ReviewController as reviewCtrl"
  48. ng-submit="reviewForm.$valid && reviewCtrl.addReview(product)">
  49. <blockquote>
  50. <b>Stars: {{ reviewCtrl.review.stars }}</b>
  51. {{ reviewCtrl.review.body }}
  52. <cite>by: {{ reviewCtrl.review.author }}</cite>
  53. </blockquote>
  54. <h4>Submit a Review</h4>
  55. <fieldset class="form-group">
  56. <select class="form-control" ng-model="reviewCtrl.review.stars" required>
  57. <option value disabled selected class>Rate the product</option>
  58. <option value="1">1 star</option>
  59. <option value="2">2 stars</option>
  60. <option value="3">3 stars</option>
  61. <option value="4">4 stars</option>
  62. <option value="5">5 stars</option>
  63. </select>
  64. </fieldset>
  65. <fieldset class="form-group">
  66. <textarea class="form-control" ng-model="reviewCtrl.review.body" required placeholder="Write a short review of the product"></textarea>
  67. </fieldset>
  68. <fieldset class="form-group">
  69. <label>by:</label>
  70. <input type="email" class="form-control" ng-model="reviewCtrl.review.author" required placeholder="john.doe@example.com" />
  71. </fieldset>
  72. <div>reviewForm is {{ reviewForm.$valid }}</div>
  73. <input type="submit" value="Submit"/>
  74. </form>
  75. </div>
  76. </section>
  77. <!-- Image Gallery -->
  78. <div class="gallery" ng-show="product.images.length">
  79. <img class="img img-circle img-thumbnail center-block"
  80. ng-src="{{product.images[0]}}"/>
  81. <ul class="clearfix">
  82. <li class="small-image pull-left thumbnail"
  83. ng-repeat="image in product.images"><img ng-src="{{image}}"/></li>
  84. </ul>
  85. </div>
  86. </div>
  87. </div>
  88. </body>
  89. </html>