AngularJS: in a input how to show '$50,000.00' when no focused but show '50000' when focused?

后端 未结 5 780
遥遥无期
遥遥无期 2020-12-09 19:05

I have a input to show a formatted number. Normally, when it has no focus, it should show a formmatted string, e.g. \'$50,000.00\'. But when it has focus, it should show the

5条回答
  •  一向
    一向 (楼主)
    2020-12-09 19:43

    you can use ng-focus to apply a filter/transformation yo your model to make it the raw value and ng-blur to make it the formatted value as for the formatting part am afraid you'll have to build your own filter. i don't know of any existing one to perform this operation, although maybe there is.

提交回复
热议问题