-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab12.html
More file actions
55 lines (43 loc) · 1.79 KB
/
lab12.html
File metadata and controls
55 lines (43 loc) · 1.79 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
<!--AngularJS - Ajax-->
<!--
AngularJS provides $https: control which works as a service to read data from the server.
The server makes a database call to get the desired records. AngularJS needs data in JSON format.
Once the data is ready, $https: can be used to get the data from server in the following manner
-->
<!DOCTYPE html>
<html ng-app="myModel">
<head>
<title>AngularJS - Ajax</title>
<meta charset="utf-8" />
<script src="Scripts/angular.js"></script>
<link rel="stylesheet" href="Content/bootstrap.css" />
<script>
//angular.element(document).ready(function () {
// angular.bootstrap(document, ["myModel"]);
//});
var mmd =angular.module("myModel", []).controller("EmployeeController", function ($scope,$http) {
var url = "Data/EmployeeData.json";
$http.get(url).success(function (response) {
//$scope.EmpolyeesList = response;
$scope.Empolyee = {
EmpolyeesList: response,
EmpolyeeAge: function (dateString) {
var today = new Date();
var birthDate = new Date(dateString);
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
};
});
});
</script>
</head>
<body ng-controller="EmployeeController">
<h2>AngularJS - Ajax</h2>
<div ng-include="'UserControl/emplist_lab11.html'"></div>
</body>
</html>