angular.module('routingApp', ['ngRoute']) .config(function ($routeProvider) { $routeProvider. when('/hello', { controller: helloCtrl, templateUrl: 'hello.html' }). //留意用. when('/about', { //這條path是指向上面routing.html的#/hello controller: aboutCtrl, templateUrl: 'about.html' }). //留意用. when('/newpage', { controller: newPageCtrl, templateUrl: 'newpage.html' }). //留意用. otherwise( //這條path是指向上面routing.html的#,other { redirectTo:'/about' } ); }) .run(function ($templateCache){ $templateCache.put('hello.html', '
{{description}}
'); });