Slide 67
Slide 67 text
Routing*
angular.module('myApp', ['ngRoute'])
.config(function($routeProvider) {
$routeProvider
.when('/', { templateUrl: 'home.html', controller: HomeCtrl })
.when('/list', { templateUrl: 'list.html', controller: ListCtrl })
.when('/detail/:id', { templateUrl: 'detail.html', controller: DetailCtrl })
.when('/settings', { templateUrl: 'settings.html', controller: SettingsCtrl })
.otherwise({ redirectTo: '/' });
});
All actual
URLs are
prepended
with a hash!
http://localhost:3000/#/settings
2
The $route provider maps URL to controllers and templates.
*Depends on another module: angular-route.js
3
1