samedi 7 mars 2015

Ember Route: Cannot read property ‘id’ of undefined

I'm getting this error, where I am trying to retrieve a user that DO NOT exist on purpose ofcouse:



Error while processing route: user Cannot read property 'id' of undefined TypeError: Cannot read property 'id' of undefined



Instead of this console error, can I give the user an error message saying, 'the user does not exist' or something like that through the route or a controller to the view?


Heres my route



App.Router.map(function () {
this.resource('user', { path: '/user/:user_id' });
});


And here i retrieve the user



App.UserRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('user', params.user_id);
},
});


Hope you understand and can help me proceed. Thanks in regards!





Aucun commentaire:

Enregistrer un commentaire