-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
44 lines (37 loc) · 944 Bytes
/
index.html
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
<!DOCTYPE HTML>
<html ng-app="users">
<head>
<title>Node Angular website</title>
<script src="lib/angular.min.js"></script>
<script type="text/javascript" src="http://code.angularjs.org/1.0.7/angular-resource.min.js"></script>
</head>
<body>
<p>testing</p>
<div ng-controller="user">
<div ng-view></div>
</div>
<script>
angular.module("users",['ngResource'])
.config(function($routeProvider){
$routeProvider
.when("/users/:id",{
controller:"user",
templateUrl:"single.html"
})
.when("/",{
controller:"usernames",
templateUrl:"single.html"
})
})
.factory("Contact",function($resource){
return $resource("/users/:id");
})
.controller('usernames',function($scope,$resource,Contact){
$scope.contacts = Contact.query();
})
.controller('user',function($scope,$resource,$routeParams, Contact){
$scope.contact = Contact.get({id:$routeParams.id})
})
</script>
</body>
</html>