0

So this is how i build my routes

[{
        route: 'Phone/:isWidget',
        moduleId: 'commonLog',
        title: 'phoneTitle',
        nav: true,
        hash: '#Phone',
        settings: { Communication: true }
},
{
        route: 'Letters/:isWidget',
        moduleId: 'commonLog',
        title: 'lettertitle',
        nav: true,
        hash: '#Letters',
        settings: { Communication: true }
}]

What i need to do is force the activate method to fire when ever i route between them.

Why would i need that?

In the activate method i pull the activeInstruction and get route information and depending on that i change my observables and call different api to get the right data and also generate the right columns for my table.

Ibrahim Ahmed
  • 2,295
  • 4
  • 21
  • 35

1 Answers1

1

In the commonLog module, you need to set a canReuseForRoute attribute that is a function that returns false. If your module is a singleton:

return {
    // ...
    canReuseForRoute: function () {
        return false;
    },
    // ...
}

If your module is a constructor function:

return function () {
    // ...
    this.canReuseForRoute = function () {
        return false;
    };
    // ...
};

Then the activate method will be called every time.

Documentation link: http://durandaljs.com/documentation/Using-The-Router.html - see section "Module Reuse".

leftclickben
  • 4,564
  • 23
  • 24