Number pipe not working

I created an ion-input that I want to the user to put numbers integer or with two decimal places. I’m using the Angular 2 pipe but it’s not working. What should I need to change?

<ion-input type="number" value="{{ exampleNumber | number : '1.2-2'}}"></ion-input>

Hi HugoPetla,

the number pipe is angular1. For ng2 use the decimal Pipe instead: https://angular.io/api/common/DecimalPipe

Sorry, but it remains the same. Don’t works like it should work.

Uh, I missed that you’d like to validate an input. Afaik Pipes are working only for output, not for input.

Check out this article, i think this is what you need

1 Like

You right, thank you. I wasn’t thinking right. xD
I solved it simply using a pattern validator, like Validators.pattern('[0-9]+(\.[0-9][0-9]?)?')