試圖找出多個嵌套視圖的概念,似乎並不明白我做錯了什麼。angularjs - 用戶界面多個嵌套視圖
app.js路由配置:
.config(function($stateProvider, $locationProvider, $urlRouterProvider) {
'ngInject';
$stateProvider.state('home', {
url: '/',
templateUrl: 'tpls/views/welcome.html'
})
.state('feeds', {
url: '/feeds',
views: {
'main': {
templateUrl: 'tpls/views/main.html'
},
'[email protected]' : {
templateUrl: 'tpls/views/sidebar.html',
controller: 'MyCtrl',
controllerAs : 'main'
},
'[email protected]': {
templateUrl: 'tpls/views/mainfeed.html',
controller: 'MyCtrl',
controllerAs : 'main'
}
}
});
$urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(true);
});
HTMLS:
上
index.html我有一個空的指令
<div ui-view></div>
,這是main.html
:
<div class="row">
<div class="col-md-4 no-float sidebar">
<div ui-view="sidebar"></div>
</div>
<div class="col-md-8 no-float">
<div ui-view="mainfeed"></div>
</div>
</div>
我的看法沒有渲染。當在/feeds
我只看到背景。 你能幫我發現問題嗎? 通過github文檔,仍然無法推斷出解決方案。 謝謝!
你告訴一切螺母都沒有提到您的問題或錯誤? –
你有一個錯誤的狀態定義它的側邊欄,因爲它應該是側邊欄 –
@CoderJohn我剛剛發現了它,但仍然感謝! –