transitionTo without URL update


#1

I am trying to implement a few different error page inside my app. In the application template I am doing the following:

    error(error, transition) {
        console.error(error);
        if (error && error.errors && error.errors[0] && error.errors[0].status === "403") {
            this.transitionTo('forbidden');
        } else if (error instanceof Ember.Error) {
            this.transitionTo('error');
        } else {
            this.transitionTo('error');
        }
    }

This works, but changes window location. I would like the location to stay the same, so a refresh on the site would try to load the last page accesses and not just refresh the error page.

Whats the best way to do this? I tried replacing transitionTo with render, but it gives a wierd error: Uncaught TypeError: Cannot read property ‘push’ of undefined


#2

If you want to keep the same URL, rather than transitionTo, you might want to identify the status code and render the appropriate template (via renderTemplate) on the error route.


#3

@tsantos83 is right.

http://emberjs.com/api/classes/Ember.Route.html#method_renderTemplate

just leave the link to api method call.