Simon Hunt | 07adc48 | 2014-12-12 16:21:08 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Simple Routing</title> |
| 5 | <script src="../../tp/angular.js"></script> |
| 6 | <script src="../../tp/angular-route.js"></script> |
| 7 | </head> |
| 8 | <body ng-app="routingApp"> |
| 9 | |
| 10 | <h2>Angular Routing</h2> |
| 11 | |
| 12 | <ul> |
| 13 | <li><a href="#/">Default Route</a></li> |
| 14 | <li><a href="#/second">Second Route</a></li> |
| 15 | <li><a href="#/asdfertdfghsdfg">Non-existent Route</a></li> |
| 16 | </ul> |
| 17 | |
| 18 | <div ng-view></div> |
| 19 | |
| 20 | <script type="text/javascript"> |
| 21 | angular.module('routingApp', ['ngRoute']) |
| 22 | .config(['$routeProvider', function ($routeProvider) { |
| 23 | $routeProvider |
| 24 | .when('/', { |
| 25 | template: '<h5>This is the default route</h5>' |
| 26 | }) |
| 27 | .when('/second', { |
| 28 | template: '<h5>This is the second route</h5>' |
| 29 | }) |
| 30 | .otherwise({ |
| 31 | redirectTo: '/' |
| 32 | }); |
| 33 | }]); |
| 34 | </script> |
| 35 | </body> |
| 36 | </html> |