Router Activation Strategy

I am trying to hook the determineActivationStrategy() callback in any of the routes in the latest esnext skeleton as such in a view model:

import { activationStrategy } from “aurelia-router”;

export class Welcome {

determineActivationStrategy() {
    console.log("in determineActivationStrategy");
    return activationStrategy.replace;


however, the above function never gets called. I have a similar skeleton where I actually call navugateToRoute on all the routes and the callback will only fire when i navigate to the same View/Model route.

I must be missing something?

I use exact same code as yours.

Can you confirm your Welcome class is directly used by a router config {moduleId: PLATFORM.moduleName('./welcome')}?

Just realize what’s your question.

It’s intend to deal with following routes:

{route: 'foo/:id', moduleId: PLATFORM.moduleName('./foo')}

When you navigate from route 'foo/1' to 'foo/2', the default behaviour is to reuse 'foo' component, only calls deactivate and activate callbaks.
activationStrategy.replace ensures you get a new 'foo' instance, and all bind/attach/… lifecycle callbacks.

If you navigate from 'foo' to 'welcome', or from 'welcome' to 'foo', that determineActivationStrategy callback is never called on both foo and welcome instances. Since they are two different class, only “replace” is doable strategy.

Thanks for this clarification huochunpeng, very much appreciated!