-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (35 loc) · 1.11 KB
/
app.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
angular.module('flapperNews', ['LocalStorageModule'])
.config(function(localStorageServiceProvider){
localStorageServiceProvider.setPrefix('univ');
localStorageServiceProvider.setStorageType('sessionStorage');
})
.factory('posts', [function(){
}])
.controller('MainCtrl', [
'$scope', function($scope){
$scope.univs = [];
$scope.addUniv = function(){
if(!$scope.university || $scope.university === '') { return; }
$scope.univs.push({
university: $scope.university,
country: $scope.country,
preference: $scope.preference,
term: $scope.term,
link: $scope.link,
rating: $scope.rating
});
$scope.university='';
$scope.country='';
$scope.preference=0;
$scope.term=1;
$scope.link='';
$scope.rating=0;
};
$scope.incrementPreference= function(univ) {
univ.preference++;
};
$scope.gridOptions = {data: 'univs'};
$scope.deleteUniv=function(idx) {
$scope.univs.splice(idx, 1);
}
}]);