How can I pass arguments to init()
or access the arguments passed to create()
inside init()
in ember.js
Just use this.get('theProperty')
Example:
var data = {
foo: "hello",
};
var MyModel = Em.Object.extend({
init: function() {
this._super();
var foo = this.get('foo');
alert(foo);
}
});
MyModel.create(data);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With