我正在尝试在 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 并在该文档中为 dashboard.tpl.html 使用 ui-view .
我已经检查了 GitHub Docs , this Plunkr 和 Stack Overflow 上的一些其他问题,但仍然无法正常工作。
最佳答案
您现在似乎不需要在状态路由器中指定模板,因为您现在正在使用组件。组件应该有模板定义。这是更多信息的链接 https://ui-router.github.io/guide/ng1/route-to-component
关于javascript - AngularJS UI 路由器嵌套状态不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43824661/