AngularJS UI 路由器嵌套状态不工作
AngularJS UI Router nested states are not working
我正在尝试在 UI-Router 中设置嵌套状态。但没有运气。我不断收到以下错误。
Uncaught Error: [$injector:modulerr] Failed to instantiate module AdminPortal due to:
Error: Cannot combine: component|bindings|componentProvider with: templateProvider|templateUrl|template|notify|async|controller|controllerProvider|controllerAs|resolveAs in stateview: '$default@auth.portal.dashboard'
这是我的路线,当我去的时候:
$stateProvider
.state('auth.portal', {
templateUrl: '/admin/dist/templates/portal.tpl.html'
})
.state('auth.portal.dashboard', {
url: '/dashboard',
component: 'dashboardComponent',
templateUrl: '/admin/dist/templates/dashboard.tpl.html'
});
portal.tpl.html
<h1>Portal</h1>
<ui-view></ui-view>
基本上我想加载 portal.tpl.html 并使用该文档中的 ui-view dashboard.tpl.html.
我已经在 Stack Overflow 上查看了 GitHub Docs, this Plunkr 和其他一些问题,但仍然无法正常工作。
您现在似乎不需要在状态路由器中指定模板,因为您现在正在使用组件。组件应该有模板定义。这里是 link 了解更多信息
https://ui-router.github.io/guide/ng1/route-to-component
我正在尝试在 UI-Router 中设置嵌套状态。但没有运气。我不断收到以下错误。
Uncaught Error: [$injector:modulerr] Failed to instantiate module AdminPortal due to:
Error: Cannot combine: component|bindings|componentProvider with: templateProvider|templateUrl|template|notify|async|controller|controllerProvider|controllerAs|resolveAs in stateview: '$default@auth.portal.dashboard'
这是我的路线,当我去的时候:
$stateProvider
.state('auth.portal', {
templateUrl: '/admin/dist/templates/portal.tpl.html'
})
.state('auth.portal.dashboard', {
url: '/dashboard',
component: 'dashboardComponent',
templateUrl: '/admin/dist/templates/dashboard.tpl.html'
});
portal.tpl.html
<h1>Portal</h1>
<ui-view></ui-view>
基本上我想加载 portal.tpl.html 并使用该文档中的 ui-view dashboard.tpl.html.
我已经在 Stack Overflow 上查看了 GitHub Docs, this Plunkr 和其他一些问题,但仍然无法正常工作。
您现在似乎不需要在状态路由器中指定模板,因为您现在正在使用组件。组件应该有模板定义。这里是 link 了解更多信息 https://ui-router.github.io/guide/ng1/route-to-component