JSFiddle - React, Tailwind, and code Playground
JavaScript
(function() {
var app = angular.module('store', []);
app.controller('StoreController', function(){
this.products = gems;
});
app.controller('PanelController', function(){
this.tab = 1;
this.selectTab = function(setTab) {
this.tab = setTab
};
this.isSelected = function(checkTab) {
return this.tab === checkTab
}
});
app.controller('ReviewController', function() {
this.review = {};
this.addReview = function(product) {
product.reviews.push(this.review);
};
});
var gems = [{
name: 'Dodecahedron',
price: 2.95,
description: '. . .',
canPurchase: true,
reviews: [
{
stars: 5,
body: "Great",
author: "ja"
},
]
},
{
name: 'Pentagonal Gem',
price: 5.95,
description: '. . .',
canPurchase: false,
reviews: [
{
stars: 5,
body: "Great",
author: "ja"
},
{
stars: 3,
body: "Average",
author: "a"
},
]
}
];
})();