如何将参数传递给 init()
或访问 ember.js 中 init()
内传递给 create()
的参数
最佳答案
只需使用this.get('theProperty')
示例:
var data = {
foo: "hello",
};
var MyModel = Em.Object.extend({
init: function() {
this._super();
var foo = this.get('foo');
alert(foo);
}
});
MyModel.create(data);
关于javascript - 在 ember.js 中将参数传递给 init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10951513/