我可以设置一个带有可选参数的路径(相同的模板和控制器,但如果它们不存在,应该忽略一些参数吗?
所以不是写下面两条规则,而是只有一条规则?
module.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/users/', {templateUrl: 'template.tpl.html', controller: myCtrl}).
when('/users/:userId', {templateUrl: 'template.tpl.html', controller: myCtrl})
}]);
Run Code Online (Sandbox Code Playgroud)
像这样的东西([这个参数是可选的])
when('/users[/:userId]', {templateUrl: 'template.tpl.html', controller: myCtrl})
//note: this previous doesn't work
Run Code Online (Sandbox Code Playgroud)
我在他们的文档中找不到任何内容.
angular ui路由器的示例演示具有此开始页面的链接:
'ui-router'的完整网址是/或 http://angular-ui.github.io/ui-router/sample/#/
'about'的完整网址是/about或http://angular-ui.github.io/ui-router/sample/#/about
当我使用durandalJS时,有一个限制,默认网址只是"/",可能没有"/ ui-router".
角度ui路由器插件有相同的限制吗?