什么是"正确的方式"(或者至少是选项,如果没有单一的"Ember方式"这样做)导航侧边栏?我应该以某种方式查看ContainerViews,还是应该使用新的插座功能并将导航粘贴到我的应用程序视图中?
另外,根据URL(我正在使用路由)在li上设置.active类的"正确方法"是什么?对此有什么帮助吗?
采用最新(从GitHub今天)余烬和灰烬的数据,这段代码是给我一个错误 - 遗漏的类型错误:无法在余烬,数据读取latest.js的未定义的属性"发现":3170
// only needed on JSFiddle; this is to trigger the route
history.pushState("", "", "/projects/1/tasks");
App = Ember.Application.create({});
App.store = DS.Store.extend({
revision: 4,
adapter: DS.RESTAdapter.create()
});
App.Project = DS.Model.extend({
name: DS.attr('string')
});
App.ApplicationController = Ember.ObjectController.extend({
});
App.ApplicationView = Ember.View.extend({
templateName: 'application'
});
App.TasksView = Ember.View.extend({
templateName: 'tasks'
});
App.Router = Ember.Router.extend({
root: Ember.Route.extend({
tasks: Ember.Route.extend({
route: '/projects/:project_id/tasks',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('Tasks');
}
})
})
});
App.router = App.Router.create({
location: 'history'
});
App.initialize(App.router);
Run Code Online (Sandbox Code Playgroud)
改变:在路径中的projects_id到其他东西(例如1,所以它匹配URL)修复了这个,但当然这不是很有用.
任何人都可以了解这里发生的事情吗?谢谢!