0

How to make custom directive in Angular2+ for giving ,(comma) between numbers? For example: 100000 should output 1,00,000 Note : [ , should be come from custom directive]

Adya
  • 1,084
  • 9
  • 17
  • If you want only show in .html use Decimal Pipe:https://angular.io/api/common/DecimalPipe, if you want to show in an `` when blur, create a directive. In https://stackoverflow.com/questions/62439134/input-matinput-angular-material-form-allow-3-decimal-points-on-input-but/62440233#62440233 you has a directive who pass three decimals to two decimals. Only change the function `transform` to set e.el the formatted number – Eliseo Jun 19 '20 at 06:29

1 Answers1

0

There is no point for custom directive. In order to achieve your use case.you can use angular built in function get Locale number format to solve your problem

Reference : https://angular.io/api/common/getLocaleNumberFormat

sunilbaba
  • 441
  • 2
  • 9