index.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 }}</cite>
  45. </blockquote>
  46. <form name="reviewForm"
  47. ng-controller="ReviewController as reviewCtrl"
  48. ng-submit="reviewCtrl.addReview(product)">
  49. <b>Stars: {{ reviewCtrl.review.stars }}</b>
  50. {{ reviewCtrl.review.body }}
  51. <cite>by: {{ reviewCtrl.review.author }}</cite>
  52. <select ng-model="reviewCtrl.review.stars">
  53. <option value="1">1 star</option>
  54. <option value="2">2 stars</option>
  55. <option value="3">3 stars</option>
  56. <option value="4">4 stars</option>
  57. <option value="5">5 stars</option>
  58. </select>
  59. <textarea ng-model="reviewCtrl.review.body"></textarea>
  60. <label>by:</label>
  61. <input type="email" ng-mode="reviewCtrl.review.author"/>
  62. <input type="submit" value="Submit"/>
  63. </form>
  64. </div>
  65. </section>
  66. <!-- Image Gallery -->
  67. <div class="gallery" ng-show="product.images.length">
  68. <img class="img img-circle img-thumbnail center-block"
  69. ng-src="{{product.images[0]}}"/>
  70. <ul class="clearfix">
  71. <li class="small-image pull-left thumbnail"
  72. ng-repeat="image in product.images"><img ng-src="{{image}}"/></li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. </body>
  78. </html>