Search code examples
angularnumberslocaleangular2-pipe

How to set locale for numbers in angular 2.0


The number format in Swiss German is like "100'000.00" (not "100,000.00"). How can I change that? I tried to change the settings in number_pipe.js from en-US to de-CH without success.

var defaultLocale: string = 'de-CH';

Is there a workaround or do I have to implement my own pipe?


Solution

  • Try using the locale-number.pipe.ts or

    you could create a simple pipe based on NumeralJs to format numbers

    https://github.com/adamwdraper/Numeral-js