Skip to content

SuiLocalizationService not working with lazy loading modules #212

@avaneev95

Description

@avaneev95

Hi @edcarroll,
I'm working on a project with a lot of lazy loading modules. It seems that the SuiLocalizationService isn't working with lazy loading modules. If I change the locale in my AppComponent (and I expect that other modules will use this locale) it won't affect lazy loading modules as they are creating their own SuiLocalizationService instance. The plunkr example ilustrates this issue.

Maybe SuiLocalizationModule can be rewrited like this:

@NgModule({
    imports: [CommonModule]
})
export class SuiLocalizationModule {
    public static forRoot():ModuleWithProviders {
        return {
            ngModule: SuiLocalizationModule,
            providers: [
                SuiLocalizationService
            ]
        };
    }
}

So in root module we can import this module as SuiLocalizationModule.forRoot() and there will be only one SuiLocalizationService.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions