-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.ctrl.js
94 lines (87 loc) · 1.91 KB
/
main.ctrl.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
82
83
84
85
86
87
88
89
90
91
92
93
94
angular.module('app').controller("MainController", function($scope, $location, $resource, $routeParams, $http) {
var vm = this;
vm.title = 'AngularJS Tut Example';
vm.searchInput = '';
vm.shows = [
{
title: 'got',
year: 2011,
fav: true
},
{
title: 'wd',
year: 2010,
fav: false
},
{
title: 'b',
year: 2013,
fav: true
},
{
title: 'ga',
year: 2005,
fav: false
}
];
vm.orders = [
{
id: 1,
title: 'Year Ascending',
key: 'year',
reverse: false
},
{
id: 2,
title: 'Year Descending',
key: 'year',
reverse: true
},
{
id: 3,
title: 'Title Ascending',
key: 'title',
reverse: false
},
{
id: 4,
title: 'Title Descending',
key: 'title',
reverse: true
}
];
vm.order = vm.orders[0];
vm.new = {};
vm.addShow = function() {
vm.shows.push(vm.new);
vm.new = {};
};
vm.addShow2 = function() {
/*
console.log('xabpu');
var showDb = $resource("/api/shows/:id", {id: "@_id"});
var new_show = new showDb({
title: 'A good Movie',
year: '2012'
});
new_show.$save(function(save_the_show) {
console.log('saved', save_the_show);
});
*/
/*
$http.put('/api/shows',
{
title: 'A good Movie',
year: 2012
});
*/
/*
showDb.get({title: 'The Hobbit'}, function(show) {
console.log(show.title);
vm.title = show.title;
});
*/
};
//vm.sampleUser = SampleUser.$get({'title': 'The Hobbit'} );
//});
});