lundi 25 mai 2015

Emberjs array controller

My route is:

export default Ember.Route.extend({
    model: function (params) {
        var blocks = this.store.find('block', {'objectId': 777});
        this.controllerFor("blocks").set('model', blocks);
        return Ember.RSVP.hash({
            object: this.store.find('object', params.id),
            blocks: blocks
        });
        //return this.store.find('object', params.id);
    }
});

My controller is:

export default Ember.ArrayController.extend({
    init: function(e){
        alert('jere');
    }
});

Alert in init function works but next I get the error:

Error while processing route: objects.bc.index Cannot read property 'length' of null TypeError: Cannot read property 'length' of null

What is the right way to get collection of models threw ajax and show it in template with custom array controller?




Aucun commentaire:

Enregistrer un commentaire