是否可以在基本网址中使用ngRoute设置路由参数?
<base href="/some/resource/path/:myParameter/" />
与:
angular.module('myApp', ['ngRoute'])
.config(["$routeProvider", "$locationProvider", function ($routeProvider, $locationProvider) {
$routeProvider
.when('/first', {
templateUrl: 'template.html',
controller: 'mainController'
})
.when('/second', {
templateUrl: 'template.html',
controller: 'mainController'
})
.when('/third', {
templateUrl: 'template.html',
controller: 'someController'
})
.when('/forth', {
templateUrl: 'template.html',
controller: 'someController'
})
.otherwise({
redirectTo: '/first'
});
$locationProvider.html5Mode(true);
}]);
获取路线:
/some/resource/path/:myParameter/first
/some/resource/path/:myParameter/second
/some/resource/path/:myParameter/third
/some/resource/path/:myParameter/forth