-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
114 lines (89 loc) · 2.5 KB
/
example.html
File metadata and controls
114 lines (89 loc) · 2.5 KB
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
105
106
107
108
109
110
111
112
113
114
<html ng-app="countryModule">
<head>
<title>Angular.js Example</title>
<script src="angular.min.js"></script>
<script src="angular-route.min.js"></script>
<h2>Welcome to Angular !</h2>
</head>
<body ng-controller="testCtrl">
<div list-items values="users"></div>
<json-table json-values="userJson" show-search="false" title="users table"></json-table>
</body>
<script>
var countryModule = angular.module('countryModule', ['ngRoute']);
countryModule.controller('testCtrl',function($scope, $timeout){
$scope.users = ["Bob","Jim","Andy","Bharath","Krishna","admin"];
$scope.userJson = [{
id:1,
name:"bharath",
designation:"developer"
},{
id:10,
name:"Admin",
designation:"server"
}];
$timeout(function(){
$scope.userJson.push({id:20,name:"NewUser",designation:"support"})
},5000);
$scope.countryDetails = [
{
"name": "China",
"population": 1359821000,
"flagURL": "//upload.wikimedia.org/wikipedia/commons/f/fa/Flag_of_the_People%27s_Republic_of_China.svg",
"capital": "Beijing",
"gdp": 12261
},
{
"name": "India",
"population": 1205625000,
"flagURL": "//upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.svg",
"capital": "New Delhi",
"gdp": 4716
},
{
"name": "United States of America",
"population": 312247000,
"flagURL": "//upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg",
"capital": "Washington, D.C.",
"gdp": 16244
}
];
});
countryModule.directive('jsonTable',function(){
return{
restrict: "E",
scope:{
jsonValues:"=",
title: "@",
showSearch:"="
},
templateUrl: "jsonTable.html",
link: function(scope,element,attrs){
scope.keyArray=[];
for(key in scope.jsonValues[0])
{
scope.keyArray.push(key);
}
}
}
});
countryModule.directive('listItems',function(){
return{
restrict: "A",
scope:{
values:"="
},
templateUrl:"list.html",
controller:"listItemCtrl",
link: function(scope,element,attrs,controller){
}
}
});
countryModule.controller('listItemCtrl',function($scope){
$scope.deleteFn = function(index)
{
$scope.values.splice(index,1);
};
});
</script>
</html>