#Localizing numberic inputs

4 messages · Page 1 of 1 (latest)

weak kelp
#

Hello everyone.
I want the page components to use a form control natively as a number (FormControl(1.2)) as this feels normal.
Then I want the actual input box to allow , for decimal inputs when in FR or GR, and use . for GB or JP for example. The point is that it should be entirely invisible to the page components.

Can anyone tell me if I can use directives to achieve this? Do I have to make a custom form component instead?
I made a sample Material component here https://stackblitz.com/edit/angular-kndgbv-voznpa?file=README.md

Is this the right approach?

Form field with custom telephone number input control.
Auto-generated from: https://material.angular.io

#

Or, another approach, write some custom FormControl just in typescript that will wrap a normal formcontrol and mess with the values?

prisma oak
#

What's wrong with an input of type number?

weak kelp
#

Doesn't let you type ,