qontu / ngx-inline-editor

Native UI Inline-editor Angular (4.0+) component
https://qontu.github.io/ngx-inline-editor
MIT License
164 stars 90 forks source link

How to format as currency? #114

Open nyc-cr2 opened 6 years ago

nyc-cr2 commented 6 years ago

Is it possible to format the output somehow? Something like this? (it doesn't work but was wondering if I'm missing a property by chance)

<inline-editor class="edit-data" type="text" [(ngModel)]="balance" onaftersave="update()">{{balance | currency:'USD':true:'2.0-0'}}</inline-editor>

tonivj5 commented 6 years ago

Hi @nyc-cr2, thanks for your reporting! :+1:

That feature is not implemented ATM. The value is shown as it's, if balance stores the number 10.1, 10.1 is shown.

I have not time to add new features, sorry... :cry: If you want help us, please, send a PR

jerodfritz commented 5 years ago

Is there a workaround of any sort for this or any way to specify a pipe or post format function before rendering the value. My use case is simpler in we just need to pipe a | number so commas get added.

jerodfritz commented 5 years ago

I've got a workaround to use a piped output but there are issues. It will error prefilling the current value to the inline editor but I can live with that

Before: <inline-editor type="number" ([ngModel])="item.hours" name="hours"></inline-editor>

Workaround: <inline-editor type="number" [ngModel]="item.hours | number" (ngModelChange)="item.hours=$event" name="hours"></inline-editor>