Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default activationStrategy in aurelia

Tags:

aurelia

Aurelia normally ignores any changes in the querystring.

It is possible to set the activationStrategy to invoke-lifecycle in the VM so it will re-run the all the life cycles in the VM when the querystring changes.

To prevent littering my code (placing it in every VM) i want to set the default activationStrategy to invoke-lifecycle.

In the interface it's explained that it is possible, but how to set it? https://github.com/aurelia/router/blob/master/src/interfaces.js

like image 594
Vijay Bin Avatar asked Oct 12 '16 13:10

Vijay Bin


1 Answers

activationStrategy is a property of RouterConfig, which represents the route config object used by config.map(). I think that you need to set it on each route definition.

Example:

configureRouter(config, router) {
  ...
  config.map([
    { 
      route: ['', 'home'],       
      name: 'home',       
      moduleId: 'home/index', 
      activationStrategy: 'invoke-lifecycle'
    }
  ]);
  ...
}

(Edit reason: I've made a terrible mistake by misreading your question at first, sorry :))

like image 81
Marton Sagi Avatar answered Sep 19 '22 12:09

Marton Sagi