app.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. this.review.createdOn = Date.now();
  19. product.reviews.push(this.review);
  20. this.review = {};
  21. };
  22. });
  23. var gems = [{
  24. name: 'Azurite',
  25. description: "Some gems have hidden qualities beyond their luster, beyond their shine... Azurite is one of those gems.",
  26. shine: 8,
  27. price: 110.50,
  28. rarity: 7,
  29. color: '#CCC',
  30. faces: 14,
  31. images: [ ],
  32. reviews: []
  33. }, {
  34. name: 'Bloodstone',
  35. description: "Origin of the Bloodstone is unknown, hence its low value. It has a very high shine and 12 sides, however.",
  36. shine: 9,
  37. price: 22.90,
  38. rarity: 6,
  39. color: '#EEE',
  40. faces: 12,
  41. images: [
  42. "images/gem-01.gif",
  43. "images/gem-03.gif",
  44. "images/gem-04.gif"
  45. ],
  46. reviews: []
  47. }, {
  48. name: 'Zircon',
  49. 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.",
  50. shine: 70,
  51. price: 1100,
  52. rarity: 2,
  53. color: '#000',
  54. faces: 6,
  55. images: [
  56. "images/gem-06.gif",
  57. "images/gem-07.gif",
  58. "images/gem-09.gif"
  59. ],
  60. reviews: []
  61. }];
  62. })();