angularangular-formlyngx-formly

How do i format a value in Angular-formly


I have to convert my input value from number to currency only after blur. But i can write it only in console.log, is it not possible to write it back in the view?

Look at the Demo And open the console. write any number and u see what the converter do. I need the Value in my input field.


Solution

  • The solution is to create a custom field type that uses one of the following option:

    1. ngx-currency https://stackblitz.com/edit/ngx-formly-custom-template-ol5cs9
    2. ngx-mask
    3. custom directive which relies on on ControlValueAccessor: https://stackblitz.com/edit/angular-hv7mnc