-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.js
104 lines (81 loc) · 2.16 KB
/
controller.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
95
96
97
98
99
100
101
102
103
104
//////////////////////////////////////////////
myApp.controller('movieRequest', function($scope, $http) {
$scope.getMovies = function () {
$http.jsonp(
'http://api.rottentomatoes.com/api/public/v1.0/movies', {
params: {
apikey: '88a8qpv9kwg657jxb97ma5nn',
q: $scope.searchTerms,
page_limit: '10',
callback: 'JSON_CALLBACK'
}
}).then(function(promise) {
$scope.movies;
for (var i = 0; i < promise.data.movies.length; i++) {
$scope.movies = promise.data.movies;
}
$scope.showResults = true;
});
/* console.log($scope.movies); */
}
$scope.moreInfo = function(index) {
$scope.movies[index].showImage = true;
};
$scope.hideInfo = function(index) {
$scope.movies[index].showImage = false;
};
});
//////////////////////////////////////////////
myApp.controller('myCtrl', function($scope) {
$scope.clickMe = function() {
$scope.clicked = true;
};
});
myApp.controller("myCtrl3", function($scope) {
$scope.list = ['Learn Angular'];
$scope.addToList = function() {
if ($scope.todo !== '') {
$scope.list.push($scope.todo);
$scope.todo = '';
}
};
});
myApp.controller("faveBooks", function($scope) {
$scope.booklist = [{
"title": "James and the Giant Peach",
"author": "James",
"description": "the giant peach",
"genre": "children"
},{
"title": "Into the Wild",
"author": "I Forgot",
"description": "Going out for a walk",
"genre": "travel"
} ];
$scope.addBookToList = function() {
if ($scope.book !== '') {
$scope.booklist.push($scope.book);
$scope.book = '';
if ($scope.booklist.length > 5) {
$scope.showBookMessage = true;
}
}
};
$scope.moreInfo = function(index) {
$scope.booklist[index].showDesc = true;
};
$scope.hideInfo = function(index) {
$scope.booklist[index].showDesc = false;
};
});
myApp.controller("registration", function($scope) {
$scope.users = [];
$scope.register = function() {
$scope.regComplete = true;
$scope.users.push($scope.user);
};
$scope.newReg = function() {
$scope.regComplete = false;
$scope.user = {};
};
});