0

Assuming I have the following Durandal route map defined...

vm.router.reset()
    .makeRelative({
        moduleId: 'salesorder/createorder',
        fromParent: true,
        route: ':cartId'
    })
    .map([
        { route: 'orderheader', moduleId: 'orderheader', title: 'Order Information', nav: 1, hash: '#createorder/' + cartId + '/orderheader' },
        { route: 'orderdetail', moduleId: 'orderdetail', title: 'Order Lines', nav: 2, hash: '#createorder/' + cartId + '/orderdetail' },
        { route: 'payment', moduleId: 'payment', title: 'Payment', nav: 3, hash: '#createorder/' + cartId + '/payment' }
    ])
    .buildNavigationModel();

... can I modify the route map specifically changing the module associated with 'payment' to a different module - say 'payment-customer-specific'? I would like to perform this modification in the middle route - in the 'orderdetail' module prior to navigating to the route 'payment' such that a specific version of the payment module is used.

I understand parameterized routes exist but they will not help because of the current codebase I am using. I understand I could create the map ahead of time for the correct module, but again, current codebase constrains this. Looking for ability to modify mapped route-to-module relationship after the fact.

Tseng
  • 61,549
  • 15
  • 193
  • 205
barrypicker
  • 9,740
  • 11
  • 65
  • 79
  • Have you considered a redirect, so that when the user navigates to payment, your `canActivate` handler would apply logic to determine if the route to *payment* should be something more specific? –  Feb 05 '15 at 20:54
  • Hi Eric, that is actually what is currently implemented. We are using the Durandal nav tag to determine which step we are in. Using the redirect, we end up having 2 payment steps one of which is stepped over. This is causing the nav display in our header section to show incorrect results. We have tried to make the customer specific payment module be a child of the parent, and set the nav tag on the cust specific to false, but this only hides the nav graphics (based on our current implementation). Perhaps I need to shift thinking towards the graphic rendering instead of map manipulation. – barrypicker Feb 05 '15 at 21:12
  • Hi. Most folks coming into Durandal will think primarily in terms of routing, and I understand why considering that that is the boast of every SPA framework out there. But as you may know, Durandal is unique in its ability to do dynamic composition. I wonder if the better approach here is simply to route no deeper than the order, and then use composition to dynamically change the payment view. –  Feb 05 '15 at 23:23
  • Eric, that is an excellent suggestion. I will review options on the current base payment module and see if I can extend\override it. – barrypicker Feb 05 '15 at 23:45

0 Answers0