0
votes

This is my router:

  this.route('bundle', { path: 'bundles/:slug', resetNamespace: true }, function () {
      this.route('pricing');
  });

So there are two child routes: index and pricing.

Index is a listing of all the products in the bundle, while pricing is where you can purchase the bundle. When somebody purchases a bundle, the pricing page displays a link-to:

{{#link-to 'bundle' bundle.slug}}View Bundle{{/link-to}}`

This hits the model hook of bundle.index, but not of the parent route bundle. I need to refresh the parent route's model after a purchase though because there are server-side changes to the model that need to be displayed in the front-end.

How can I make that happen?

1
didTransition hook of bundle will also called when pricing or index route is loaded. I guess you can use that or else you can send an action from the child routes to the parent.acid_srvnn
Your path definition looks weird. I don't thing your index route should have :slug in path.Keo

1 Answers

0
votes

On transition hook you can ask for parent model with modelFor.

willTransition(){
  let model = this.modelFor('bundle');
}

Although it may be possible that you will have to redefine your routes because it look like your base router has path with parameter.