0
我有以下模板:为什么我会显示?
<script type="text/x-handlebars" data-template-name="projects">
<div class="container-fluid">
<div class="row-fluid">
{{#linkTo "projects"}}Root{{/linkTo}}
{{#each controller}}
<div class="span4">
{{#linkTo "projects.show" this}}{{this.name}}{{/linkTo}}
</div>
{{/each}}
</div>
{{outlet}}
</div>
</script>
和:
<script type="text/x-handlebars" data-template-name="projects/show">
<h2>Overview of {{name}}</h2>
</script>
和app.js以下内容:
App = Ember.Application.create({
LOG_TRANSITIONS: true
});
App.Project = DS.Model.extend({
name: DS.attr("string"),
key : DS.attr("string")
});
App.Router.map(function() {
this.resource("projects",function() {
this.route("show", {path: "/:project_id"});
});
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo("projects");
}
});
App.ProjectsRoute = Ember.Route.extend({
model: function() {
return this.store.find("project");
},
})
和下面的模型设置:
App.Store = DS.Store.extend({
adapter: DS.FixtureAdapter // run with fixture data
});
App.Project.FIXTURES = [
{
id: 1,
name: 'Proj1',
key: "P1KEY"
},
{
id: 2,
name: 'Proj2',
key: "P2KEY"
},
];
当我第一次导航到页面时,我看到以下3个链接(Root,Proj1和Proj2)。由于我在索引视图我起初,我看到:
然后,我点击第一个项目,我看到:
而且,最后我回到指数,但项目/节目内容似乎依然存在:
任何人都可以解释发生了什么?
我真该死!它也适用于我,我添加了应用程序模板后...然后我删除它,现在我的版本也可以工作。我试图清理我的资产/浏览器缓存,它仍然有效。奇怪的东西:) – Geo