-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
83 lines (66 loc) · 2.05 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
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
var App=angular.module('App',[])
App.controller('mainController', function($scope, $http){
var hide='on'
var show='off'
$scope.disp=hide
$scope.msg=''
$scope.col='green'
$scope.dispdetails=hide
$scope.get = function () {
// $http.get('one.json').then(function(response) {
$http.get('?num='+$scope.num).then(function(response) {
// var j=response.data.pop()
$scope.disp=hide
$scope.name=response.data.name
$scope.num=response.data.num
$scope.company=response.data.company
$scope.batch=response.data.batch
$scope.email=response.data.email
// $scope.name=j.name
// $scope.num=j.num
// $scope.company=j.company
// $scope.batch=j.batch
// $scope.email=j.email
$scope.dispdetails=show
// if (j.name==undefined) {
if (response.data.name==undefined) {
$scope.msg='Sorry, we don\'t have you in our database'
$scope.col='orange'
$scope.disp=show
$scope.dispdetails=hide
}
},function(res){
$scope.msg='Error '+res.status+' '+res.statusText
$scope.col='red'
$scope.disp=show
$scope.dispdetails=hide
})
}
$scope.update = function () {
$http.post('update').then(function(res) {
$scope.msg='Thanks you!'
$scope.disp=show
$scope.col='green'
}, function(res){
$scope.msg='Error '+res.status+' '+res.statusText
$scope.disp=show
$scope.col='red'
})
}
$scope.clearmsg = function () {
$scope.msg=''
$scope.disp=hide
$scope.dispdetails=hide
}
$scope.clear = function () {
$scope.name=''
// $scope.num=''
$scope.company=''
$scope.batch=''
$scope.email=''
}
$scope.add = function () {
$scope.dispdetails=show
$scope.clear()
}
});