简体   繁体   English

AngularJS UI路由器嵌套状态不起作用

[英]AngularJS UI Router nested states are not working

I am trying to have nested states in UI-Router. 我正在尝试在UI-Router中嵌套状态。 But with no luck. 但是没有运气。 I keep getting the following error. 我不断收到以下错误。

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'

This is my route, when I go to the : 这是我去的路线:

$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 portal.tpl.html

<h1>Portal</h1>
<ui-view></ui-view>

Basicaly I want to load portal.tpl.html and use the ui-view in that document for the dashboard.tpl.html . 基本上,我想加载portal.tpl.html并将该文档中的ui视图用于dashboard.tpl.html

I already checked out the GitHub Docs , this Plunkr and some other questions on Stack Overflow, but still not working. 我已经检查了GitHub Docs这个 Plunkr以及关于Stack Overflow的其他一些问题,但是仍然无法正常工作。

It seems you don't need to specify tempale in your State router as you are using components now. 似乎您现在不需要使用状态路由器,因为您现在正在使用组件。 Components should have the template definitions. 组件应具有模板定义。 Here is the link for more info https://ui-router.github.io/guide/ng1/route-to-component 这是更多信息的链接https://ui-router.github.io/guide/ng1/route-to-component

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM