Jak*_*kub 1 state angularjs angular-ui-router
我有一条路线:
.state('home.blog', {
url: "/blog",
templateUrl: "blog.html",
controller: "BlogController"
})
Run Code Online (Sandbox Code Playgroud)
我的路线是localhost:3000/home/blog我想改变它localhost:3000/blog.我搜索了互联网,但我没有找到任何简单的解决方案.
这是因为url部分是从父级中删除的.但是我们可以明确设置,' ^ ' 不应该使用父级:
.state('home.blog', {
url: "^/blog",
templateUrl: "blog.html",
controller: "BlogController"
})
Run Code Online (Sandbox Code Playgroud)
见文档
如果您想要绝对URL匹配,那么您需要在url字符串前面加上特殊符号'^'.
$stateProvider
.state('contacts', {
url: '/contacts',
...
})
.state('contacts.list', {
url: '^/list',
...
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
880 次 |
| 最近记录: |