Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- var app= angular.module('store', []);
- app.controller('TestController', function(){
- this.products = gems;
- });
- var gems = [
- {
- name:'Bitch',
- price: 0,
- description: 'is a bitch',
- canPurchase: true,
- reviews: [{
- stars: 5,
- body: "I love this gem so much I'd marry it!",
- author: "joe@example.org",
- createdOn: 1397490980837
- },
- {
- stars: 1,
- body: "I'd suck this gem cuz it sucks.",
- author: "tim@example.org",
- createdOn: 1397490980837
- }]
- },
- {
- name:'Madafaka',
- price: 666,
- description: 'is satan',
- canPurchase: true,
- reviews: [{
- stars: 5,
- body: "I love this gem!",
- author: "joe@example.org",
- createdOn: 1397490980837
- },
- {
- stars: 1,
- body: "This gem sucks.",
- author: "tim@example.org",
- createdOn: 1397490980837
- }]
- }
- ];
- app.controller('PanelController',function(){
- this.tab = 1;
- this.selectTab=function(setTab){
- this.tab=setTab;
- };
- this.isSelected=function(thisTab){
- return this.tab === thisTab;
- };
- });
- app.directive("reviewsPanel",function(){
- return{
- restrict:'E',
- templateUrl:'reviews-panel.html',
- scope:{
- product:'bind'
- },
- controller: function($scope){
- this.review = {};
- this.addReview = function($scope){
- $scope.product.reviews.push(this.review);
- this.review = {};
- };
- },
- controllerAs:'reviewsCtrl'
- };
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement