blob: 296141276bb5fb274fc8b74a5f06cf0d55157811 (
plain)
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
|
<!DOCTYPE html>
<html>
<head>
<title>Simple Routing</title>
<script src="../../tp/angular.js"></script>
<script src="../../tp/angular-route.js"></script>
</head>
<body ng-app="routingApp">
<h2>Angular Routing</h2>
<ul>
<li><a href="#/">Default Route</a></li>
<li><a href="#/second">Second Route</a></li>
<li><a href="#/asdfertdfghsdfg">Non-existent Route</a></li>
</ul>
<div ng-view></div>
<script type="text/javascript">
angular.module('routingApp', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/', {
template: '<h5>This is the default route</h5>'
})
.when('/second', {
template: '<h5>This is the second route</h5>'
})
.otherwise({
redirectTo: '/'
});
}]);
</script>
</body>
</html>
|