app.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. (function() {
  2. var app = angular.module('gemStore', []);
  3. app.controller('StoreController', function () {
  4. this.products = gems;
  5. });
  6. app.controller('PanelController', function () {
  7. this.tab = 1;
  8. this.selectTab = function (setTab) {
  9. this.tab = setTab;
  10. };
  11. this.isSelected = function (checkTab) {
  12. return this.tab === checkTab;
  13. }
  14. });
  15. app.controller('ReviewController', function () {
  16. this.review = {};
  17. this.addReview = function(product) {
  18. product.reviews.push(this.review);
  19. this.review = {};
  20. };
  21. });
  22. var gems = [{
  23. name: 'Azurite',
  24. description: "Some gems have hidden qualities beyond their luster, beyond their shine... Azurite is one of those gems.",
  25. shine: 8,
  26. price: 110.50,
  27. rarity: 7,
  28. color: '#CCC',
  29. faces: 14,
  30. images: [ ],
  31. reviews: []
  32. }, {
  33. name: 'Bloodstone',
  34. description: "Origin of the Bloodstone is unknown, hence its low value. It has a very high shine and 12 sides, however.",
  35. shine: 9,
  36. price: 22.90,
  37. rarity: 6,
  38. color: '#EEE',
  39. faces: 12,
  40. images: [
  41. "images/gem-01.gif",
  42. "images/gem-03.gif",
  43. "images/gem-04.gif"
  44. ],
  45. reviews: []
  46. }, {
  47. name: 'Zircon',
  48. description: "Zircon is our most coveted and sought after gem. You will pay much to be the proud owner of this gorgeous and high shine gem.",
  49. shine: 70,
  50. price: 1100,
  51. rarity: 2,
  52. color: '#000',
  53. faces: 6,
  54. images: [
  55. "images/gem-06.gif",
  56. "images/gem-07.gif",
  57. "images/gem-09.gif"
  58. ],
  59. reviews: []
  60. }];
  61. })();