PollRoutes.coffee
$stateProvider.state 'polls.new',
url: '/new'
views:
"":
templateUrl: 'polls/form.html'
controller: 'PollController'
"page_title":
template: "<h1 class='page-header'>Create a new poll</h1>"
resolve:
auth: ["Auth", (Auth)-> Auth.currentUser()]
$stateProvider.state 'polls.edit',
url: '/:id/edit'
views:
"":
templateUrl: 'polls/form.html'
controller: 'PollController'
"page_title":
template: "<h1 class='page-header'>Edit poll \"{{poll.title}}\"</h1>"
resolve:
auth: ["Auth", (Auth)-> Auth.currentUser()]
插入 polls / form.html.slim
div ng-view='page_title'
我尝试了各种视图格式:&#34; page_title&#34;,&#34; page_title @&#34;,&#34; page_title@polls.edit"并且没有一个工作
答案 0 :(得分:0)
您的$state
应该是这样的。
$stateProvider
.state('polls', {
url: '/',
data: {pageTitle: 'Edit poll.'},
resolve: {//here your functions},
views: {
'navbar': {
templateUrl: null, //here your template
controller: null //here your controller
},
'body': {
templateUrl: "polls/form.html",
controller: 'PollController'
}
}});
和你的观点一样,
<div ng-view='navbar'></div>
<div ng-view='body'></div>
并且你的tittle可以像这样加载,
<title ng-bind="title">My tittle</title>