I want to transition to a "oops" route when there is error loading model. My router looks like:
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
export default
Router.map(function() {
this.resource('invitations', {path: '/invitations'});
this.resource('oops');
});
InivitationsRoute has error action defined as:
import Ember from 'ember';
export default
Ember.Route.extend({
actions: {
error: function(error, transition) {
if (error && error.status === 500) {
transition.abort();
this.transitionTo('oops',{'a':'b'});
}
// Return true to bubble this event to any parent route.
return false;
}
}
});
Now the problem i am seeing is, if I pass an object to the this.transitionTo('oops',{'a':'b'}); , then ember doesn't even try to do a transition, but if I just did this.transitionTo('oops');, it would transition to the route. The problem is I want to pass error JSON as model to this route!
My OopsRoute is minimalistic :
import Ember from 'ember';
export default
Ember.Route.extend({
setupController: function(controller, model) {
this._super(controller, model);
}
});
Can't seem to understand why it wouldn't work! Using ember : 1.11.3
Aucun commentaire:
Enregistrer un commentaire