-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
38 lines (30 loc) · 1.18 KB
/
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
<html>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<div>Path: {{path}}</div>
<div>Hash: {{hash}}</div>
<button ng-click="setPath()">Change Path</button>
<button ng-click="setHash()">Change Hash</button>
</div>
<script src="angular.min.js"></script>
<script>
var myApp = angular.module('myApp', []);
function myCtrl($scope, $location) {
$scope.curPath = 1;
$scope.curHash = 1;
$scope.setPath = function(){
$location.path('foo' + $scope.curPath);
$scope.path = $location.path();
$scope.curPath += 1;
};
$scope.setHash = function(){
$location.hash('bar' + $scope.curHash);
$scope.hash = $location.hash();
$scope.curHash += 1;
};
$scope.path = $location.path();
$scope.hash = $location.hash();
}
</script>
</body>
</html>