Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
pipes: change detection on language change #11
After some testing I noticed that by making the pipe impure (
When a pipe is pure Angular only creates one instance of the pipe and uses that for every pipe reference, when a pipe is impure Angular creates one instance per pipe reference, so the concept of subscribing to languageChanged needs multiple instances of the pipe. Otherwise only one of the pipes will be updated.
I'm looking into creating a pure pipe that has multiple instances. For now I'll close this merge request.
@SteveVanOpstal Hi, thank you for PR. Somehow i missed it.
The problem is that angular IOC container resolves dependencies as singleton, once LOCALE_ID was requested it will always resolve as the same value (first resolved). The only way to get actual LOCALE_ID value is to register LOCALE_ID as factory function, but than it will break libraries that expect LOCALE_ID to be 'string' (not function).
That is why i ended up with simply refreshing page with a new language. We only need to setup right language, locale and formats on angular initialization.