-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTablecontroller.js
62 lines (48 loc) · 2.23 KB
/
Tablecontroller.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
var app = angular.module('mymodule', []);
app.controller('tablecontroller', function($scope,$http,$log, ajaxService) {
$scope.formdata ={};
scope = $scope;
$scope.myWelcome = ajaxService.ajaxCall($scope,$http,$log,"GET","http://www.tutorialspoint.com/json/data.json");
$scope.info = ajaxService.ajaxCall($scope,$http,$log,"GET","https://www.w3schools.com/angular/customers.php")
var employees=[
{name:"Tom",gender:"1",National_ID: "131",likes:0,Dislikes:0},
{name:"Ruby",gender:"2",National_ID: "135",likes:0,Dislikes:0},
{name:"Pamela",gender:"1",National_ID: "145",likes:0,Dislikes:0},
{name:"Sam",gender:"1",National_ID: "152",likes:0,Dislikes:0},
{name:"Moseph",gender:"3",National_ID: "157",likes:0,Dislikes:0},
];
$scope.employees = employees;
$scope.rowlimit =3;
$scope.message ="Welcome to angularJS";
$scope.like = function(employees){
employees.likes++;
}
$scope.Dislike = function(employees){
employees.Dislikes++;
}
$scope.submit = function(formdata){
scope.errormessage = "";
if(formdata.name == undefined ||
formdata.name == "" || formdata.country == undefined
|| formdata.country == ""){
scope.errormessage =" >> Please enter email and Password";
}
else{
$scope.formdata = ajaxService.ajaxCall($scope,$http,$log,"POST","http://www.tutorialspoint.com/json/data.json")
}
}
$scope.cancel = function(formData){
scope.formdata = "";
scope.errormessage = "";
}
$scope.updateTime = function() {
$scope.data.time = new Date();
}
//$digest()
document.getElementById("updateTimeButton")
.addEventListener('click', function() {
console.log("update time clicked");
$scope.data.time = new Date();
$scope.$digest();
});
});