Is there a general way (i.e. in application-router) to abort transitions if the target (including dynamic ids) matches the current route?
I tried hooking into willTransition but the transition.params I found seem to contain the current ids and I have nothing to compare them to.
The params
attribute of the transition will reference the current route's params, not the target. What you need is to look at the models provided to the transition via its providedModels
attribute. Your code should look like this:
willTransition: function(transition) {
if ((this.get('routeName') === transition.targetName) &&
(this.get('currentModel') === transition.providedModels[transition.targetName])) {
transition.abort();
return;
}
// ... other code here ...
}