How can I get ui-router ui-sref to point to a URL
如何让ui-router ui-sref指向URL
Here's my link:
这是我的链接:
<a ui-sref="admin.overview"</a>
and my configuration
我的配置
var admin = {
name: 'admin',
url: '/admin',
views: {
'root': {
templateUrl: '/Content/app/admin/partials/home.html',
},
'content': {
templateUrl: '/Content/app/admin/partials/overview.html',
},
}
};
var adminContent = {
name: 'admin.content',
parent: 'admin',
url: '/:content',
views: {
'root': {
templateUrl: '/Content/app/admin/partials/home.html',
},
'content': {
templateUrl: function (stateParams) {
return '/Content/app/admin/partials/' + stateParams.content + '.html';
},
}
}
};
$stateProvider.state(admin).state(adminContent)
This works if I point to a like with ui-sref='admin' but how can I get it to point to /admin/overview? or the link works if I code href="/admin/overview" myself? However the ui-sref doesn't create anything with the ui-sref="admin.overview".
如果我指向ui-sref='admin',但我怎样才能让它指向/管理/概述呢?或者如果我自己编写href="/admin/overview",那么这个链接就可以运行了?但是ui-sref不使用ui-sref="admin.overview"创建任何内容。
1 个解决方案
#1
3
Here is the documentation for ui-sref: https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref
下面是ui-sref的文档:https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref
Essentially, you need to enter the desired state, and any parameters that you want to include. For your example, I think:
本质上,您需要输入所需的状态,以及您想要包含的任何参数。以你为例,我认为:
<a ui-sref="admin.content({ content: 'overview' })">Overview Page</a>
#1
3
Here is the documentation for ui-sref: https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref
下面是ui-sref的文档:https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref
Essentially, you need to enter the desired state, and any parameters that you want to include. For your example, I think:
本质上,您需要输入所需的状态,以及您想要包含的任何参数。以你为例,我认为:
<a ui-sref="admin.content({ content: 'overview' })">Overview Page</a>