{"id":13580604,"url":"https://github.com/nbfontana/ngx-currency","last_synced_at":"2025-05-14T18:00:28.125Z","repository":{"id":25698467,"uuid":"105294903","full_name":"nbfontana/ngx-currency","owner":"nbfontana","description":"Currency mask module for Angular 📦 ","archived":false,"fork":false,"pushed_at":"2025-01-06T20:03:50.000Z","size":3919,"stargazers_count":244,"open_issues_count":80,"forks_count":120,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-13T10:54:06.992Z","etag":null,"topics":["angular","angular2","aot","chrome","components","currency","directive","firefox","mask","money"],"latest_commit_sha":null,"homepage":"https://nbfontana.github.io/ngx-currency","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbfontana.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-29T16:36:43.000Z","updated_at":"2025-04-04T04:40:08.000Z","dependencies_parsed_at":"2024-01-11T20:59:06.961Z","dependency_job_id":"524af42f-0ce9-4d1c-9763-457a05d93dfb","html_url":"https://github.com/nbfontana/ngx-currency","commit_stats":{"total_commits":145,"total_committers":24,"mean_commits":6.041666666666667,"dds":"0.43448275862068964","last_synced_commit":"43ddc165ffe9fd561766815491e45fe55ff0b27d"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbfontana%2Fngx-currency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbfontana%2Fngx-currency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbfontana%2Fngx-currency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbfontana%2Fngx-currency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbfontana","download_url":"https://codeload.github.com/nbfontana/ngx-currency/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183599,"owners_count":22028534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular2","aot","chrome","components","currency","directive","firefox","mask","money"],"created_at":"2024-08-01T15:01:53.508Z","updated_at":"2025-05-14T18:00:28.106Z","avatar_url":"https://github.com/nbfontana.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Third Party Components"],"sub_categories":["Forms"],"readme":"# ngx-currency\n\n[![npm version](https://badge.fury.io/js/ngx-currency.png)](http://badge.fury.io/js/ngx-currency)\n[![GitHub issues](https://img.shields.io/github/issues/nbfontana/ngx-currency.png)](https://github.com/nbfontana/ngx-currency/issues)\n[![GitHub stars](https://img.shields.io/github/stars/nbfontana/ngx-currency.png)](https://github.com/nbfontana/ngx-currency/stargazers)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.png)](https://raw.githubusercontent.com/nbfontana/ngx-currency/master/LICENSE)\n\n## Demo\n\nhttps://nbfontana.github.io/ngx-currency/\n\n## Table of contents\n\n- [Getting Started](#getting-started)\n- [Documentation](https://nbfontana.github.io/ngx-currency/docs/)\n- [Development](#development)\n- [License](#license)\n\n## Getting Started\n\n### Installing and Importing\n\nInstall the package by command:\n\n```sh\nnpm install ngx-currency --save\n```\n\nImport the directive\n\n```ts\nimport { NgxCurrencyDirective } from \"ngx-currency\";\n\n@Component({\n  selector: \"app-root\",\n  templateUrl: \"./app.component.html\",\n  imports: [NgxCurrencyDirective],\n})\nexport class AppComponent {}\n```\n\n### Using\n\n```html\n\u003cinput type=\"text\" inputmode=\"decimal\" currencyMask formControlName=\"value\" /\u003e\n```\n\n- `ngModel` An attribute of type number. If is displayed `'$ 25.63'`, the attribute will be `'25.63'`.\n\n### Options\n\nYou can set options...\n\n```html\n\u003c!-- example for pt-BR money --\u003e\n\u003cinput [currencyMask]=\"{ prefix: 'R$ ', thousands: '.', decimal: ',' }\" formControlName=\"value\" /\u003e\n```\n\nAvailable options:\n\n- `align` - Text alignment in input. (default: `right`)\n- `allowNegative` - If `true` can input negative values. (default: `true`)\n- `decimal` - Separator of decimals (default: `'.'`)\n- `precision` - Number of decimal places (default: `2`)\n- `prefix` - Money prefix (default: `'$ '`)\n- `suffix` - Money suffix (default: `''`)\n- `thousands` - Separator of thousands (default: `','`)\n- `nullable` - when true, the value of the clean field will be `null`, when false the value will be `0`\n- `min` - The minimum value (default: `undefined`)\n- `max` - The maximum value (default: `undefined`)\n- `inputMode` - Determines how to handle numbers as the user types them (default: `Financial`)\n\nInput Modes:\n\n- `Financial` - Numbers start at the highest precision decimal. Typing a number shifts numbers left.\n  The decimal character is ignored. Most cash registers work this way. For example:\n  - Typing `'12'` results in `'0.12'`\n  - Typing `'1234'` results in `'12.34'`\n  - Typing `'1.234'` results in `'12.34'`\n- `Natural` - Numbers start to the left of the decimal. Typing a number to the left of the decimal shifts\n  numbers left; typing to the right of the decimal replaces the next number. Most text inputs\n  and spreadsheets work this way. For example:\n  - Typing `'1234'` results in `'1234'`\n  - Typing `'1.234'` results in `'1.23'`\n  - Typing `'12.34'` results in `'12.34'`\n  - Typing `'123.4'` results in `'123.40'`\n\nYou can also set options globally...\n\n```ts\nimport { provideEnvironmentNgxCurrency, NgxCurrencyInputMode } from 'ngx-currency';\n\nbootstrapApplication(AppComponent, {\n  providers: [\n    ...\n    provideEnvironmentNgxCurrency({\n      align: \"right\",\n      allowNegative: true,\n      allowZero: true,\n      decimal: \",\",\n      precision: 2,\n      prefix: \"R$ \",\n      suffix: \"\",\n      thousands: \".\",\n      nullable: true,\n      min: null,\n      max: null,\n      inputMode: NgxCurrencyInputMode.Financial,\n    }),\n    ...\n  ],\n}).catch((err) =\u003e console.error(err));\n```\n\n## Development\n\n### Prepare your environment\n\n- Install [Node.js](http://nodejs.org/) and NPM\n- Install local dev dependencies: `npm install` while current directory is this repo\n\n### Development server\n\nTo start a local development server, run:\n\n```bash\nnpm start\n```\n\n### Building\n\nTo build the library run:\n\n```bash\nnpm run build:lib\n```\n\n### Testing\n\nTo execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:\n\n```bash\nnpm test\n```\n\nWhen running in the Chrome browser, you can set code breakpoints to debug tests using these instructions:\n\n- From the main Karma browser page, click the `Debug` button to open the debug window\n- Press `ctrl + shift + i` to open Chrome developer tools\n- Press `ctrl + p` to search for a file to debug\n- Enter a file name like `input.handler.ts` and click the file\n- Within the file, click on a row number to set a breakpoint\n- Refresh the browser window to re-run tests and stop on the breakpoint\n\n## License\n\nMIT @ Neri Bez Fontana\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbfontana%2Fngx-currency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbfontana%2Fngx-currency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbfontana%2Fngx-currency/lists"}