Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Routing with Webpack #668

Open
DanieleRosada opened this issue Nov 26, 2020 · 3 comments
Open

Dynamic Routing with Webpack #668

DanieleRosada opened this issue Nov 26, 2020 · 3 comments

Comments

@DanieleRosada
Copy link

Hi,
I have a problem with navigationStrategy. I load only the first time moduleId, then when I change the route the moduleId remains the same even if the route #has the right name . (No error)
I use aurelia with webpack.

Thanks

PLATFORM.moduleName('./tipologia/CALDAIA/dettagli');
PLATFORM.moduleName('./tipologia/REFRIGERATORE/dettagli');
PLATFORM.moduleName('./tipologia/SCAMBIATORE/dettagli');
PLATFORM.moduleName('./tipologia/COMPONENTE/dettagli');
PLATFORM.moduleName('./tipologia/BRUCIATORE/dettagli',);
PLATFORM.moduleName('./tipologia/UIR/dettagli');
@autoinject()
export class Installati {

    constructor(private router: Router) { }

    configureRouter(config: RouterConfiguration, router: Router) {
        this.router = router;

        const navStrat = (instruction: NavigationInstruction) => {
            instruction.config.moduleId = './tipologia/' + instruction.params.TipologiaInstallato + '/dettagli';
            instruction.config.href = instruction.fragment;
        };

        config.map([
            { route: '', name: 'no-selected', moduleId: PLATFORM.moduleName('assistenza/utilities/no-selected') },
            { route: ':TipologiaInstallato/:IdInstallato/*', name: 'dettagli', navigationStrategy: navStrat },
        ]);
    }

}
@bigopon
Copy link
Member

bigopon commented Nov 28, 2020

It's a bit complicated guessing what you want to achieve. Can you help create a small repro describing what the issue? I've prepared a gist https://gist.dumber.app/?gist=5dfee522d31bab9df9bd7c03bf4567f8

@davismj
Copy link
Member

davismj commented Nov 29, 2020

how many modules do you have for this pattern?

@DanieleRosada
Copy link
Author

I can't replicate the error, but thanks for repro. Webpack is the problem, it doesn't load files correctly.
I want webpack to load 6 modules and not just the first one used so that through the router parameters I can identify which one I have to use to achieve correct navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants