{"id":16430908,"url":"https://github.com/nightapes/ngx-phone-validators","last_synced_at":"2025-07-21T12:39:21.111Z","repository":{"id":40744609,"uuid":"134422881","full_name":"Nightapes/ngx-phone-validators","owner":"Nightapes","description":"angular validator for phone numbers ","archived":false,"fork":false,"pushed_at":"2023-01-07T04:14:31.000Z","size":1062,"stargazers_count":10,"open_issues_count":20,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T15:49:51.972Z","etag":null,"topics":["angular","angular2","angular7","google-libphonenumber","phone","validators"],"latest_commit_sha":null,"homepage":"","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/Nightapes.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":"2018-05-22T13:54:24.000Z","updated_at":"2022-06-29T17:57:56.000Z","dependencies_parsed_at":"2023-02-06T11:31:31.100Z","dependency_job_id":null,"html_url":"https://github.com/Nightapes/ngx-phone-validators","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/Nightapes/ngx-phone-validators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nightapes%2Fngx-phone-validators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nightapes%2Fngx-phone-validators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nightapes%2Fngx-phone-validators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nightapes%2Fngx-phone-validators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nightapes","download_url":"https://codeload.github.com/Nightapes/ngx-phone-validators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nightapes%2Fngx-phone-validators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266303622,"owners_count":23908373,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","angular7","google-libphonenumber","phone","validators"],"created_at":"2024-10-11T08:28:42.873Z","updated_at":"2025-07-21T12:39:21.095Z","avatar_url":"https://github.com/Nightapes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ngx-phone-validators\n\n[![npm](https://david-dm.org/nightapes/ngx-phone-validators.svg)](https://david-dm.org/nightapes/ngx-phone-validators)\n\nAn implementation of various angular validators for Angular 2+.\n\n# List of validators\n\n1. Phone\n\n# Install\n\n`npm install ngx-phone-validators --save`\n\n## [Angular CLI](https://github.com/angular/angular-cli)\n\nNo config needed\n\n## [Angular Seed](https://github.com/mgechev/angular-seed)\n\nAdd following to `project.config.ts`\n\n```ts\nlet additionalPackages: ExtendPackages[] = [\n  {\n    name: \"google-libphonenumber\",\n    path: \"node_modules/google-libphonenumber/dist/libphonenumber.js\"\n  },\n  {\n    name: \"ngx-phone-validators\",\n    path:\n      \"node_modules/ngx-phone-validators/bundles/ngx-phone-validators.umd.min.js\"\n  }\n];\n\nthis.addPackagesBundles(additionalPackages);\n```\n\nFor AOT add\n\n```ts\nthis.ROLLUP_NAMED_EXPORTS = [\n  ...this.ROLLUP_NAMED_EXPORTS,\n  {\n    \"node_modules/google-libphonenumber/dist/libphonenumber.js\": [\n      \"PhoneNumberUtil\"\n    ]\n  }\n];\n```\n\n## Install\n\n```\nnpm install ngx-phone-validators --save\n```\n\n## How to use [model driven]\n\nneeds: `ReactiveFormsModule`\n\n### Phones\n\n```ts\nimport {PhoneValidators} from 'ngx-phone-validators'\n\n...\nphone: FormControl = new FormControl('', Validators.compose([\n    PhoneValidators.isValidRegionCode,\n    PhoneValidators.isPhoneNumber('DE'),\n    PhoneValidators.isPossibleNumberWithReason('DE'),\n    ]));\n```\n\n```\nregionCode: FormControl = new FormControl('', PhoneValidators.isValidRegionCode);\nphoneNumber: FormControl = new FormControl('', PhoneValidators.isPhoneNumber('DE'));\npossiblePhoneNumber: FormControl = new FormControl('', PhoneValidators.isPossibleNumberWithReason('DE'));\n```\n\n## How to use [template driven]\n\nneeds `FormsModule and PhoneValidatorsModule`\n\n```ts\nimport { NgModule } from \"@angular/core\";\nimport { BrowserModule } from \"@angular/platform-browser\";\nimport { FormsModule } from \"@angular/forms\";\nimport { PhoneValidatorsModule } from \"ngx-phone-validators\";\n\nimport { AppComponent } from \"./app.component\";\n\n@NgModule({\n  imports: [BrowserModule, FormsModule, PhoneValidatorsModule],\n  declarations: [AppComponent],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n```\n\n### Phone\n\n```html\n\u003cform\u003e\n  \u003cinput\n    [(ngModel)]=\"model.phone\"\n    name=\"phone\"\n    #formControl=\"ngModel\"\n    phone=\"DE\"\n  /\u003e\n  \u003cspan *ngIf=\"formControl.hasError('noValidRegionCode')\"\n    \u003eInvalid region code\u003c/span\n  \u003e\n  \u003cspan *ngIf=\"formControl.hasError('noPhoneNumber')\"\n    \u003eNo valid phone number\u003c/span\n  \u003e\n\u003c/form\u003e\n```\n\n### Country Code\n\n```html\n\u003cform\u003e\n  \u003cinput\n    [(ngModel)]=\"model.phone\"\n    name=\"phone\"\n    #formControl=\"ngModel\"\n    countryCode\n  /\u003e\n  \u003cspan *ngIf=\"formControl.hasError('noValidRegionCode')\"\n    \u003eInvalid region code\u003c/span\n  \u003e\n\u003c/form\u003e\n```\n\n### Possible phone\n\n```html\n\u003cform\u003e\n  \u003cinput\n    [(ngModel)]=\"model.phone\"\n    name=\"phone\"\n    #formControl=\"ngModel\"\n    possiblePhone=\"DE\"\n  /\u003e\n  \u003cspan *ngIf=\"formControl.hasError('noValidRegionCode')\"\n    \u003eInvalid region code\u003c/span\n  \u003e\n  \u003cspan *ngIf=\"formControl.hasError('noPhoneNumber')\"\n    \u003eNo valid phone number\u003c/span\n  \u003e\n  \u003cspan *ngIf=\"formControl.hasError('phoneNumberTooLong')\"\n    \u003ePhone number too long\u003c/span\n  \u003e\n  \u003cspan *ngIf=\"formControl.hasError('phoneNumberTooShort')\"\n    \u003ePhone number too short\u003c/span\n  \u003e\n\u003c/form\u003e\n```\n\nGet the complete changelog here: https://github.com/Nightapes/ngx-phone-validators/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightapes%2Fngx-phone-validators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightapes%2Fngx-phone-validators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightapes%2Fngx-phone-validators/lists"}