ember.js是否仍然支持ObjectController?如果没有,什么替代它? [英] Does ember.js still support ObjectController? If not, what replaces it?
问题描述
App.userController = SC.ObjectController.create({
content:SC。 Object.create({
firstName:Albert,
lastName:Hofmann,
posts:25,
hobbies:骑自行车
})
});
查看ember.js源代码,似乎支持的唯一控制器类型是arryay控制器。在不是数组/集合和视图的一部分的单一模型对象之间是否存在一个确定的最佳做法?或者人们放弃代理,并直接在模型和查看对象之间建立绑定?想法?
更新:是, Ember.ObjectController
是第一个 - Ember的一部分,最常用于代理模型的属性,以便通过模板轻松呈现。请参阅 http://emberjs.com/api/classes/Ember.ObjectController.html用于文档。
I'm trying to learn some Ember.js and while I realize everything is in flux and the moment, it seems that this bit of code from the Sproutcore 2 guides (which are linked to at the Ember.js github readme) doesn't work any longer:
App.userController = SC.ObjectController.create({
content: SC.Object.create({
firstName: "Albert",
lastName: "Hofmann",
posts: 25,
hobbies: "Riding bicycles"
})
});
Looking at the ember.js source, the only type of controller that seems to be supported is an arryay controller. Is there an established best practice for proxying between a single model object that is not part of an array/collection and a view? Or do people forego the proxying and simply set up bindings directly between the model and view objects? Thoughts?
UPDATED: Yes, Ember.ObjectController
is a first-class part of Ember and is most frequently used to proxy a model's properties for easy rendering by templates. See http://emberjs.com/api/classes/Ember.ObjectController.html for documentation.
这篇关于ember.js是否仍然支持ObjectController?如果没有,什么替代它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!