2016-02-02 88 views
0

我想通过与UI路由器三层嵌套我的路线。AngularJS查看不更新第三级嵌套的路由与角UI路由器

我只包括导致问题的路线的平安,因为我的路线 有点大,不想在这里包含所有内容。读它可能会很痛苦。但如果你认为我应该包括更多,请让我知道。

app.js

.state('elements', { 
     url: '/elements', 
     views: { 
     nav: { 
      templateUrl: 'components/directives/main-nav.html' 
     }, 
     content: { 
      templateUrl: 'views/main-nav/elements.html' 
     }, 
     localFooter: { 
      templateUrl: 'views/footer/elements-subnav.html' 
     }, 
     globalFooter: { 
      templateUrl: 'views/footer/global-footer.html' 
     } 
     }, 
     ncyBreadcrumb: { 
     label: 'elements' 
     } 
    }) 
    .state('elements.elements-library', { 
     url: '/elements-library', 
     views: { 
     nav: { 
      templateUrl: 'components/directives/main-nav.html' 
     }, 
     content: { 
      templateUrl: 'views/elements-subnav/elements-library.html' 
     }, 
     localFooter: { 
      templateUrl: 'views/footer/elements-subnav.html' 
     }, 
     globalFooter: { 
      templateUrl: 'views/footer/global-footer.html' 
     } 
     }, 
     ncyBreadcrumb: { 
     label: 'elements library' 
     } 
    }) 
    .state('elements.elements-library.neutral-colors', { 
     url: '/neutral-colors', 
     views: { 
     nav: { 
      templateUrl: 'components/directives/main-nav.html' 
     }, 
     content: { 
      templateUrl: 'views/elements-library/neutral-colors.html', 
      controller: 'pageslideController' 
     }, 
     globalFooter: { 
      templateUrl: 'views/footer/global-footer.html' 
     } 
     }, 
     ncyBreadcrumb: { 
     label: 'neutral colors' 
     } 
    }) 

我只显示元素 - library.html文件的和平有链接,进入第三级嵌套的路线。

元素 - library.html

<div class="row"> 
    <div class="col-xs-12"> 

    <h2 class="evo-header-10-bold" id="neutral-colors">Neutral Colors<a ui-sref="elements.elements-library.neutral-colors" href="javascript: void(0);" class="evo-icon-10 evo-icon-circle-chevron-right" style="float: right; margin-top: 5px;"></a></h2> 

    <div class="evo-space-15"></div> 

    </div> 
</div> 
下面

是,我想从元素 - library.html

中性的颜色,当点击在视图中加载中性colors.html页.HTML

<div class="container"> 

<div class="row"> 
    <div class="col-xs-12"> 
    <div ncy-breadcrumb></div> 
    </div> 
</div> 

<div class="row"> 
    <div class="col-xs-12"> 
    <h2 class="evo-header-15-bold no-line">Neutral Colors</h2> 
    </div> 
</div> 

</div> 

而且从index.html文件,我只是表明我有我ncluded数据的UI视图= “内容”

的index.html

<div data-ui-view="content" class="container" ng-cloak></div> 

当我点击链接 “一UI-SREF =” elements.elements-library.neutral,颜色... “从elements-library.html中,我的URL地址更新为http://localhost:3000/#/elements/elements-library/neutral-colors,我的ncy-breadcrumb也更新为”元素/元素库/中性色“,但页面的其余部分(内容)不更新。

在第三级嵌套“.STATE(‘elements.elements-library.neutral-颜色’”我甚至试图改变内容:内容@元素:但后来我得到这个错误:

Uncaught SyntaxError: Unexpected token ILLEGAL

Uncaught Error: [$injector:nomod] Module 'evolution' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

+0

似乎是多余的重复每个路线中的所有相同的意见,当儿童路线可以在家长的'ui-view'设置 – charlietfl

+0

'content @'而不是'content @ elements'怎么样? – pbo

+0

我试过'content @',我仍然得到相同的错误。 –

回答