mardi 22 mars 2016

For EmberJs models, why is recommended not to override the `init` method

Why is it recommended not to super override an EmberJs model objects init method?

I implemented this code, and it is working perfectly fine (for now, I guess):

import Ember from 'ember';

export default Ember.Object.extend({
    init() {
        this._super();
        if (!this.get('type')) {
            this.set('type', this.get('typeDefault'));
        }
    },
});

The EmberJs docs on init are here

Here is one article not recommending it.

http://ift.tt/1VARCEF




Aucun commentaire:

Enregistrer un commentaire