{"id":21097464,"url":"https://github.com/emerbrito/ng-input-mask","last_synced_at":"2026-04-29T10:04:00.656Z","repository":{"id":57111355,"uuid":"175230442","full_name":"emerbrito/ng-input-mask","owner":"emerbrito","description":"Angular input mask directive.","archived":false,"fork":false,"pushed_at":"2019-03-15T05:19:53.000Z","size":140,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T03:05:13.072Z","etag":null,"topics":["angular","angular7","directive","input-mask","mask"],"latest_commit_sha":null,"homepage":null,"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/emerbrito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-12T14:34:21.000Z","updated_at":"2019-03-25T14:26:23.000Z","dependencies_parsed_at":"2022-08-21T00:01:01.833Z","dependency_job_id":null,"html_url":"https://github.com/emerbrito/ng-input-mask","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/emerbrito/ng-input-mask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emerbrito%2Fng-input-mask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emerbrito%2Fng-input-mask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emerbrito%2Fng-input-mask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emerbrito%2Fng-input-mask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emerbrito","download_url":"https://codeload.github.com/emerbrito/ng-input-mask/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emerbrito%2Fng-input-mask/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910052,"owners_count":22930670,"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","angular7","directive","input-mask","mask"],"created_at":"2024-11-19T22:48:21.492Z","updated_at":"2026-04-29T10:04:00.611Z","avatar_url":"https://github.com/emerbrito.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InputMask Angular Directive\nA mask directive with support for custom rules and Angular forms.  \nProvides advanced masking capabilities while working well with (and mostly transparent to) context menu and keyboard operations such as copy and paste.\n\nBasic usage:\n````html\n\u003cinput inputMask mask=\"999-99-9999\"\u003e\n````\n\n## Rules\nThe following are the predefined mask rules:\n\n Rule | Description \n:----:|:------------\n 9 | Accepts any digit between 0 and 9.\n 0 | Accepts any digit between 0 and 9 or space.\n \\# | Same as rule 9. Also allows + (plus) and - (minus) signs.\n L | Accepts any letters (a-z and A-Z).\n ? | Accepts any letter (a-z and A-Z) or space.\n \u0026 | Accepts any character except a space. Equivalent to \\S in regular expressions.\n C | Accepts any character. Equivalent to . in regular expressions.\n A | Alphanumeric. Accepts letters and digits only.\n a | Alphanumeric or space. Accepts letters, digits and space.\n\n### Escaping Rules\nUse the character `|` (pipe) to escape any of the mask rules and use them as literals.\n\n## Using InputMask\nStart by importing the `InputMaskModule`:\n\n````javascript\nimport { InputMaskModule } from '@emerbrito/input-mask';\n````\n\nThen apply the directive to an input element and set the mask property:\n\n````html\n\u003cinput inputMask mask=\"999-99-9999\"\u003e\n````\n\n### Getting Unformatted Value\nAs expected the mask will change the input value as it is entered.  \nTo access the unformatted value (among with additional info) listen to the directive's `format` event:\n\n````html\n\u003cinput inputMask mask=\"999-99-9999\" (format)=\"onFormat($event)\"\u003e\n````\n\n````javascript\nonFormat(event: MaskEvent) {\n    console.log('Formatted value: ', event.value);\n    console.log('Clean value: ', event.cleanValue);\n}\n````\n\n## Angular Forms\nBy default, when used inside an Angular form the directive will interact with `FormControl` setting its invalid state based on whether or not the input satisfies the mask.\n\nTo prevent the mask validation from propagating to the form control (if you is being used) set the `validateMask` property to `false`.\n\n````html\n\u003cinput inputMask mask=\"999-99-9999\" validateMask=\"false\"\u003e\n````\n\n### Custom Rules\nFor a use case not covered by the built in rules, new custom rules can be created and registered with the directive. See [wiki](https://github.com/emerbrito/ng-input-mask/wiki) form more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femerbrito%2Fng-input-mask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femerbrito%2Fng-input-mask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femerbrito%2Fng-input-mask/lists"}