所以,看來我並沒有得到ui-router
,畢竟。如何正確使用嵌套路由修復以下示例?
這裏是破例如: http://plnkr.co/edit/WgDqTzE3TJjrCZ2pxg5T?p=preview
實際的文件結構爲:
app/
app.js
index.html
main/
main.html
header/
header.html
footer/
footer.html
sections/
content1/
content1.html
content2/
...
index.html
具有簡單<div ui-view></div>
main.html
具有:
<div ui-view="header"></div>
<div ui-view></div>
<div ui-view="footer"></div>
header.html
,footer.html
,content1.html
......有實際內容。
app.js
有:
$stateProvider
.state("app", {
url: "",
abstarct: true,
templateUrl: "main.html"
})
.state("app.main", {
url: "",
abstarct: true,
views: {
"header": {
templateUrl: "header.html"
},
"footer":{
templateUrl: "footer.html"
}
}
})
.state("app.main.content1", {
url: "/",
templateUrl: "content1.html"
});
所以,我認爲,這表示要「/」會告訴我的頁眉,頁腳,並自動在無名ui-view
插入內容。
它沒有。我究竟做錯了什麼?
你有沒有設立
無論是在應用程序和app.main? – Whisher 2014-10-03 12:06:54不知道我明白你在說什麼.. :) – fusio 2014-10-03 12:14:36