Abort transition in a detail view


#1

Having this router:

App.Router.map(function() {
    this.resource('products', function() {
      this.route('show', {
        path: '/:productId'
      });
    });
});

I’m in the route products/12345 and I want to abort the transition from the ProductsShowRoute to another route without losing the 12345 id of the path; I’m trying this:

App.ProductsShowRoute = Em.Route.extend({
  actions: {
    willTransition: function(transition) {
      transition.abort();
    }
  }
});

The problem is that the path loses the product id :frowning: Can someone help me?


#2

Not sure why you would want to do this (maybe I don’t understand your question).

The whole purpose of the transition.abort() method is to prevent the transition from occurring, meaning that you’ll remain on the source state path (without id in path).