Skip to content

Bug(scope): Alias lost when transloco signals are usedΒ #899

@paradox37

Description

@paradox37

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

It seems the alias is lost in some cases. If the page is first loaded, with a component that has transloco signals and scope in the component, e.g.,

providers: [provideTranslocoScope({ scope: 'shared-lib', alias: 'lib' })]
anotherTitle = translateSignal('anotherTitle');

And then, if you go to the page which has the same scope in the providers, the alias is totally lost, and accessing {{ "lib.anotherTitle" | transloco }} will result in an error in the console, and translation text will be missing.

This can be reproduced in the codesandbox I provided. Click on the "Some page" link, and you will see that the translation is not loaded. But, stay on that page, press reload in codesandbox, translation will be there, no errors. Also, if you now click on the link "Home", all is fine, the translation will now work on all the pages.

Expected behavior

Alias not to be lost in any case when using provideTranslocoScope()

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

https://codesandbox.io/p/devbox/4q5hl8

Transloco Config

Please provide the environment you discovered this bug in

Transloco: 8.2.1
Angular: 18, 21
Node: 
Package Manager: 24.11.1
OS: Windows

Browser

Chrome Desktop v144

Additional context

No response

I would like to make a pull request for this bug

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions