Faced a problem when using ngx-meta and ngx-translate packages in Angular Universal RouterModule when setting up on RouterModule initialNavigation with the value 'enabled' .

Then, when rendering a page instead of meta tags, only the values ​​for substituting from the language pack are 'HOME.TITLE' : 'HOME.TITLE' , 'HOME.DESC' , etc.

On a subsequent transition, when the spa turns on, the meta is picked up, but the roles are no longer big. If you remove the initialNavigation , then when rendering the page, everything is picked up well, but flickering begins.

    1 answer 1

    All you had to do was register APP_INITIALIZER . Below is an example:

     export function initLanguage(translateService: TranslateService): Function { return (): Promise<any> => translateService.initLanguage(); } @NgModule({ // ... providers: [ { provide: APP_INITIALIZER, useFactory: initLanguage, multi: true, deps: [TranslateService] }, ] }) // ... 

    And on the initLanguage method initLanguage just set the definition of a language, etc.