【发布时间】:2017-10-05 02:22:59
【问题描述】:
我正在尝试在 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 和其他一些问题,但仍然无法正常工作。
【问题讨论】:
-
我可以看到错误清楚地说明了这一点。您应该从状态定义中删除
templateUrl属性,这对我来说更有意义.. 因为组件将处理 URL
标签: javascript angularjs angular-ui-router angular-components