samedi 4 novembre 2017

Ember: Unable to get model in controller init function

I have a ember application whose route, controller are as follows:

//Route
model:function(){
    return this.store.getJSON('object/');
},
setupController:function(controller, model){
    controller.set('content', model)
}


//controller
init:function(){
    this.myfunction();
},
myfunction:function(){
  var content = this.get('content')
  console.log(content.length)
}

myfunction gets executed when the page/template is loaded and it returns "cannot read property of null" . I am unable to get route model in controller init function.




Aucun commentaire:

Enregistrer un commentaire