-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdish.js
81 lines (70 loc) · 3.34 KB
/
dish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
(function() {
'use strict';
angular.module('confusionApp', [])
.controller('dishDetailController', dishDetailController)
.controller('DishCommentController',DishCommentController);
dishDetailController.$inject = ['$scope'];
function dishDetailController($scope){
$scope.dish = {
name:'Uthapizza',
image: 'uthapizza.png',
category: 'mains',
label:'Hot',
price:'4.99',
description:'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
comments: [
{
rating:5,
comment:"Imagine all the eatables, living in conFusion!",
author:"John Lemon",
date:"2012-10-16T17:57:28.556094Z"
},
{
rating:4,
comment:"Sends anyone to heaven, I wish I could get my mother-in-law to eat it!",
author:"Paul McVites",
date:"2014-09-05T17:57:28.556094Z"
},
{
rating:3,
comment:"Eat it, just eat it!",
author:"Michael Jaikishan",
date:"2015-02-13T17:57:28.556094Z"
},
{
rating:4,
comment:"Ultimate, Reaching for the stars!",
author:"Ringo Starry",
date:"2013-12-02T17:57:28.556094Z"
},
{
rating:2,
comment:"It's your birthday, we're gonna party!",
author:"25 Cent",
date:"2011-12-02T17:57:28.556094Z"
}
]
}
};
DishCommentController.$inject = ['$scope'];
function DishCommentController($scope){
$scope.fedbck = { author : "",
rating : 5,
comment : "",
date : ""
}
$scope.go = function(fedbck){
$scope.fedbck.date = new Date().toISOString();
$scope.fedbck.rating = parseInt($scope.fedbck.rating);
console.log($scope.commentForm);
$scope.dish.comments.push($scope.fedbck);
$scope.fedbck = {author : "",
rating : 5,
comment : "",
date : ""
}
$scope.commentForm.$setPristine();
$scope.commentForm.$setUntouched();
};
};
})();