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

Two redirects in router and child router #66

Closed
milunka opened this issue Apr 15, 2015 · 3 comments
Closed

Two redirects in router and child router #66

milunka opened this issue Apr 15, 2015 · 3 comments
Labels

Comments

@milunka
Copy link

milunka commented Apr 15, 2015

I saw strange behaviour of aurelia router when i was using router with one child router and both of them use redirect parameter in router configuration. I have prepared forked repository of skeleton-navigation repository where my problem is implemented:
https://github.com/milunka/redirect-problem

For quick review, this is what i am talking about:
app.js - this viewmodel has defined only one route where empty route is redirecting to defined route

import {inject} from 'aurelia-framework';
import {Router} from 'aurelia-router';

@inject(Router)
export class App {
  constructor(router) {
    this.router = router;
    this.router.configure(config => {
      config.title = 'Aurelia';
      config.map([
        { route: 'child',       moduleId: './appChild',      nav: true, title:'Welcome' },
        { route: '', redirect: 'child' }
      ]);
    });
  }
}

appChild.js - in this viewmodel is again empty route which redirects to defined route

import {inject} from 'aurelia-framework';
import {Router} from 'aurelia-router';

@inject(Router)
export class AppChild {
  constructor(router) {
    this.router = router;
    this.router.configure(config => {
      config.title = 'Aurelia';
      config.map([
        { route: 'welcome',       moduleId: './welcome',      nav: true, title:'Welcome' },
        { route: '', redirect: 'welcome' }
      ]);
    });
  }
}

After i try to access application root (http://localhost:9000) i receive error Illegal module name "", same error is displayed when i try to access route after first redirect (http://localhost:9000/#child). Only url which works is whole route to welcome page (http://localhost:9000/#child/welcome).

I think that both url (http://localhost:9000 and http://localhost:9000/#child) may works, but maybe i just didn't understand redirect parametr in router configuration.

@pekkah
Copy link

pekkah commented Jun 15, 2015

+1 for fixing this

@alexisargyris
Copy link

Is this still a problem? Any workaround?

@Alexander-Taran
Copy link
Contributor

@EisenbergEffect added to vNext router use cases list.
Can be closed

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

No branches or pull requests

5 participants