Ionic 2 thousand format


#1

How to format number with thousand separator in ionic 2.

I have used {{var1|number:0}}

But it has error when I build project


#2

This works for me.
It provides a comma i.e. thousand separator (that may which you want). Right?


#3

I use templateUrl.

in HTML file I use {{ myVar | number:0 }}

but I get error when I build android

The error is :
Argument of type ‘number’ is not assignable to parameter of type ‘string’


#4

I don’t know what it is happening with you.

I tried myVar variable with string of type. But still showing the same output.

(and I even tried interpolation i.e. {{ myVar }} in the other file like you are asking about templateUrl.
Both are the same thing, whether you write an expression with interpolation (i.e. {{ myVar }}) in the same file using template or in other file using templateUrl. )