2

I have such page module:

import { NgModule, LOCALE_ID } from '@angular/core';
...

@NgModule({
  imports [
  ...
  ],
  declarations [
  ...
  ],
  entryComponents [
  ...
  ],
  providers [
  {provide: LOCALE_ID, useValue: localStorage.getItem('localization')}
  ]
})

And when I come to page, my LOCAL_ID gets the value from localStorage. But if my item in locaLstorage gets change, LOCAL_ID is not updating. How to do that?

V. Aliosha
  • 152
  • 1
  • 1
  • 14

1 Answers1

0

This question may help to solve your problem. Changing locale in Angular at runtime?

I use ngx-translate to work with different languages in Angular and I think is the best soution.

Nil Micola
  • 74
  • 4