2016-07-05 52 views
0

我曾在$routeProvider的某個時間安靜,現在我想我可能有一個要求,如果我實施$stateProvider會更好,因爲它具有優於$routeProvider的優勢。stateProvider中的嵌套視圖AngularJS

我想在 this Plunker實現嵌套視圖,但我想我誤解了一些東西,所以我的[email protected]不起作用。它在HTML中實現

關於 - >聯繫我們 - > HeadQuater地址 - >手機號碼:(空白)

.state('about1',{ 
    url: '/about', 
    views:{ 
    '': {templateUrl: 'partial-about.html'}, 
    '[email protected]' : { template: 'Office Address here' }, 
    '[email protected]' : { 
     templateUrl: 'hq-adr.html', 
     controller: function($scope){ 
     $scope.msg= "HeadQuater Address here" 
     }, 
     view:{ 
     '[email protected]': {template: '+91-99999 99999'} 
     } 

    } 
    } 
}) 

從我從互聯網上了解,[email protected]是語法。

+0

什麼不在你的代碼中工作? – Prianca

+0

你打算說'hqChild'沒有顯示數字? –

+0

@PankajParkar:是的 –

回答

2

我改變了你的plunker了一下,我想你想實現的是將hqchild模板插入<div ui-view="hqChild"></div>hq-adr.html。這裏是編輯的plunker

我不認爲嵌套veiw:下命名的意見在ui路由器中是有效的。我做的更改如下

.state('about1',{ 
    url: '/about', 
    views:{ 
    '': {templateUrl: 'partial-about.html'}, 
    '[email protected]' : { template: 'Office Address here' }, 
    '[email protected]' : { 
     templateUrl: 'hq-adr.html', 
     controller: function($scope){ 
     $scope.msg= "HeadQuater Address here" 
     } 
    }, 
    '[email protected]': {template: '+91-99999 99999'} 
    } 
})