-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
65 lines (55 loc) · 1.46 KB
/
app.js
File metadata and controls
65 lines (55 loc) · 1.46 KB
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
(function(){
// Define the Angular Application
var app = angular.module('store', []);
// try to Define a few handy constants
//app.constant('addCart', 'Add To Cart');
// Define the Controller
app.controller('StoreController', function(){
this.products = gems;
});
app.controller('PanelController', function(){
// make the first tab displayed equal to tab with the value of 1
this.tab = 1;
// set the tab by passing in the number of the current selection
this.selectTab = function(setTab) {
this.tab = setTab;
}
// check if the tab is selected or not at that moment and return a boolean here
this.isSelected = function(checkTab) {
return this.tab === checkTab;
}
})
app.controller('GalleryController', function() {
this.imageIndex = 0;
this.currentImageChange = function(imageNumber) {
console.log(imageNumber);
this.imageIndex = imageNumber || 0;
};
});
var gems = [
{
name: 'Azurite',
price: 2.95,
description: 'Some gems have hidden qualities beyond their luster, beyond their shine... Azurite is one of those gems.',
canPurchase: true,
soldOut: true,
images: [
'img/gem-02.gif',
'img/gem-05.gif',
'img/gem-09.gif'
]
},
{
name: 'Bloodstone',
price: 5.95,
description: 'Origin of the Bloodstone is unknown, hence its low value. It has a very high shine and 12 sides, however.',
canPurchase: true,
soldOut: false,
images: [
'img/gem-01.gif',
'img/gem-03.gif',
'img/gem-04.gif'
]
}
];
})();