ember.js 还支持 ObjectController 吗?如果不是,用什么代替? [英] Does ember.js still support ObjectController? If not, what replaces it?
问题描述
我正在尝试学习一些 Ember.js,虽然我意识到一切都在不断变化,但似乎来自 Sproutcore 2 指南的这段代码(链接到 Ember.js github 自述文件)不再起作用:
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"
})
});
查看 ember.js 源代码,似乎支持的唯一类型的控制器是 arryay 控制器.在不属于数组/集合的单个模型对象和视图之间进行代理是否有既定的最佳实践?或者人们是否放弃代理并直接在模型和视图对象之间设置绑定?想法?
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?
推荐答案
更新:是的,Ember.ObjectController
是 Ember 的一流部分,最常用于代理模型的属性通过模板轻松渲染.见 http://emberjs.com/api/classes/Ember.ObjectController.html 用于文档.
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屋!