2

I have a peculiar case.

Say I am on root.com/product/1/detail

I want to be able to change the product dynamic segment, but still be in the detail sub route. for example `root.com/product/2/detail

And if I am in root.com/product/1 I want the SAME transition code to go to `root.com/product/2

Normally, you'd put something like transitionToRoute('product', this.get('id')), but that takes me only to the product route. I need the extra flexibility of preserving any sub routes the visitor may currently be in.

Perhaps there is some sort of "currentRoute" property I can hook into like transitionToRoute('controller.currentRoute', this.get('id')) while passing in new ids or objects for dynamic segments?

ahnbizcad
  • 10,491
  • 9
  • 59
  • 85

1 Answers1

1

You can set current route using:

currentRoute = App.__container__.lookup('controller:application').get('currentPath')

Then you should be able to do something along the lines of what you mentioned:

transitionToRoute('currentRoute', this.get('id'))
Sid
  • 2,683
  • 18
  • 22