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

Children routes issue lazy load module #6

Closed
BruneXX opened this issue Sep 16, 2019 · 2 comments
Closed

Children routes issue lazy load module #6

BruneXX opened this issue Sep 16, 2019 · 2 comments

Comments

@BruneXX
Copy link

BruneXX commented Sep 16, 2019

I'm submitting a ... (check one with "x")

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if similar feature request does not exist
[x ] support request => Suggested place for help and support is [stackoverflow](https://stackoverflow.com/), search for similar question before posting

Description

I having an issue related to the child routes,
I've main module app-routing.module.ts importing the main routes like:

{
    path: 'auth',
    loadChildren: './components/auth/auth.module#AuthModule'
  }

Then in the auth.routes.ts, I've the following:

export const routes = [
  { path: 'login', component: LoginComponent },
  { path: 'register', component: RegisterComponent }
];

then in auth.module.ts:

import { routes } from './auth.routes';
import { LocalizeRouterModule } from '@gilsdav/ngx-translate-router';

[....]

  imports: [
    RouterModule.forChild(routes),
    LocalizeRouterModule.forChild(routes)
 ]

But trying to access to translated route, for example:

/en/auth/register                       works **OK**
/es/autenticacion/registro         translated route is simply **NOT WORKING**.

Instead of that I'm receiving the following error:
core.js:4002 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'es/autenticacion/registro'

The weird thing is that, if in my main routes (app.routes.ts) that then is imported in app.module.ts add the following:

{
    path: 'auth',
    loadChildren: './components/auth/auth.module#AuthModule'
  },
  {
    path: 'auth/register',
    loadChildren: './components/auth/auth.module#AuthModule'
  },
  {
    path: 'auth/login',
    loadChildren: './components/auth/auth.module#AuthModule'
  }

it works like a charm, so the issue is just when I trying to add children routes. And it's simply giving that error...

🌍 Your Environment

Angular Version: 8.2.5
Localize Router Version: 2.0.0

@BruneXX BruneXX changed the title Children routes issue lazy modules Children routes issue lazy load module Sep 16, 2019
@gilsdav
Copy link
Owner

gilsdav commented Dec 14, 2019

@BruneXX Sorry I didn't seen your issue.
Do you still have it ?

@gilsdav
Copy link
Owner

gilsdav commented Dec 14, 2019

For answer, check Greentube/localize-router#169

@gilsdav gilsdav closed this as completed Dec 14, 2019
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

2 participants