initpublic
An overridable method called when objects are instantiated. By default, does nothing unless it is overridden during class definition.
Example:
App.Person = Ember.Object.extend({ init: function() { alert('Name is ' + this.get('name')); } }); var steve = App.Person.create({ name: "Steve" }); // alerts 'Name is Steve'.
NOTE: If you do override init
for a framework class like Ember.View
, be sure to call this._super(...arguments)
in your init
declaration! If you don't, Ember may not have an opportunity to do important setup work, and you'll see strange behavior in your application.
Please login to continue.