-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.js
37 lines (31 loc) · 1.15 KB
/
test2.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
app.controller("testCtrl",function($scope,$http,MatchService,$rootScope,TimeFnService){
$scope.resultHTML = "Test Html";
$scope.Displayflag=true;
$scope.uname = $rootScope.user;
MatchService.data($rootScope.user).then(function(res){
Matches = res.data;
$scope.Matches = Matches;
var finishedMatches = [];
var upcomingMatches = [];
for (index = 0; index < Matches.length; ++index) {
match = Matches[index];
if(TimeFnService.compareDate(new Date('2015-04-15'),match.Matchdate) == 1)
finishedMatches.push(match);
else
upcomingMatches.push(match);
};
$scope.finishedMatches = finishedMatches;
$scope.upcomingMatches = upcomingMatches;
});
$scope.Insert = function(mid,sel){
$http.post("http://localhost:5433/postMatchPred",{"username":"manoj", "matchid" : mid,"selection": sel}).success(function(html){
$scope.resultHTML = html;
});
}
$scope.submit = function(match){
$http.post("http://localhost:5433/postMatchPred",{"username":$rootScope.user, "matchid" : match.matchid,"selection": match.selection}).success(function(html){
$scope.resultHTML = html;
match.dbselection = 1;
});
}
});