2016-02-02 85 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 @',我仍然得到相同的錯誤。 –

回答