0
我在一個頁面上和一個視圖內有多個視圖我嵌套view.How應該配置此app.js.Given下面是我的代碼不工作。
這是我的index.html文件使用ui路由器在多個視圖中嵌套視圖angularjs
<body ng-app="configuratorApp" >
<div ui-view="view1"></div>
<div ui-view="view2"></div>
</body>
這是我view1.html文件
<div ui-view> </div>
<button type="button" ui-sref="view1.child1"></button>
<button type="button" ui-sref="view1.child2"></button>
這是我的廠景,child1.html文件
<h1>Child1<h1>
這是我的廠景-child2.html文件
<h1>Child2<h1>
這是我view2.html文件
<h1>Hello World</h1>
這是我app.js文件
.state('home',{
url: '/',
views: {
'': {
templateUrl: 'index.html'
},
'[email protected]': {
templateUrl: 'view1.html'
},'[email protected]': {
templateUrl: 'view2.html'
}
}
})
.state('view1.child1', {
url: '/child1',
templateUrl: 'view1-child1.html'
})
.state('view1.child2', {
url: '/child2',
templateUrl: 'view1-child2.html'
})