我定义了以下状态:
var test = {
name: 'test',
url: '/test',
views: {
'page': {
templateUrl: '/Content/app/test/partials/page.html',
},
}
}
var testContent = {
name: 'test.content',
parent: 'test',
url: '/:content',
views: {
'page-content': {
templateUrl: function (stateParams) {
var isNumber = !isNaN(parseFloat(stateParams.content));
return isNumber ? '/Content/app/test/partials/detail.html' :
'/Content/app/test/partials/home.html'
}
}
}
}
在我的HTML中,我有:
<article class="container_12" >
<div data-ui-view="page"></div>
</article>
在我的page.html中,我有:
<div data-ng-controller="TestPageController">
<div class="grid_3">
Menu stuff here
</div>
<div class="grid_9">
<div data-ui-view="page-content"></div>
</div>
</div>
我想知道的是,我的应用程序是否有办法在页面内容中显示home.html 当我只选择url:/ test
时答案 0 :(得分:21)
您可以在ui-view
内放置任何内容,这将是默认内容。
加载其他视图后,它将替换默认内容:
<div data-ng-controller="TestPageController">
<div class="grid_3">
Menu stuff here
</div>
<div class="grid_9">
<div data-ui-view="page-content">
<div ng-include="/Content/app/test/partials/home.html"></div>
</div>
</div>
</div>