所以,看来我并没有得到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