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

Bug(transloco): Loader with scope not working for NotFound route expression ** #724

Open
1 task done
Maksclub opened this issue Oct 29, 2023 · 1 comment
Open
1 task done

Comments

@Maksclub
Copy link

Maksclub commented Oct 29, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) are the source of the bug?

Transloco

Is this a regression?

No

Current behavior

Loader definition:

export const provideAppLangScope = () => {
  return provideTranslocoScope({
    scope: 'app',
    alias: 'app',
    loader: SUPPORTED_LANGUAGES.reduce((acc: HashMap<() => Promise<Translation>>, lang) => {
      acc[lang] = () => import(`./i18n/${lang}.json`);
      return acc;
    }, {})
  })
}

Routes definition:

// working (on /not route)
 {
   path: 'not',
   loadChildren: () => import('./page.not-found/routes').then(m => m.ROUTES),
   providers: [
     provideAppLangScope(),
   ],
 },

// not working on /bla-bla-bla
 {
   path: '**',
   loadChildren: () => import('./page.not-found/routes').then(m => m.ROUTES),
   providers: [
     provideAppLangScope(),
   ],
 }

ROUTES definition:

export const ROUTES = [
  {
    path: '',
    loadComponent: async () => (await import(`./not-found`)).NotFoundComponent,
  },
] as Route[];

Expected behavior

loader for '**' route definition working correct

Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.

Transloco Config

No response

Please provide the environment you discovered this bug in

Transloco: ^6.0.0
Angular: 16
Node: v20.6.1
Package Manager: 9.8.1
OS: Mac OS

Browser

Chrome
Safari
Firefox

Additional context

No response

I would like to make a pull request for this bug

No

@Maksclub Maksclub changed the title Loader with scope not working for NotFound route expression ** Bug(transloco): Loader with scope not working for NotFound route expression ** Oct 29, 2023
@Maksclub
Copy link
Author

I provided provideAppLangScope() in NotFound component and it's working!
Temporal solution for me

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

1 participant