Gathering detailed insights and metrics for @vidalsasun/ngx-mat-intl-tel-input_5.0.0
Gathering detailed insights and metrics for @vidalsasun/ngx-mat-intl-tel-input_5.0.0
npm install @vidalsasun/ngx-mat-intl-tel-input_5.0.0
Typescript
Module System
Node Version
NPM Version
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Latest Version
1.0.0
Package Id
@vidalsasun/ngx-mat-intl-tel-input_5.0.0@1.0.0
Unpacked Size
123.18 kB
Size
64.63 kB
File Count
53
NPM Version
8.11.0
Node Version
16.16.0
Publised On
15 Jan 2023
Cumulative downloads
Total Downloads
Last day
0%
0
Compared to previous day
Last week
0%
0
Compared to previous week
Last month
0%
0
Compared to previous month
Last year
0%
0
Compared to previous year
15
31
An Angular Material package for entering and validating international telephone numbers. It adds a flag dropdown to any input, detects the user's country, displays a relevant placeholder and provides formatting/validation methods.
Supports:
$ npm install libphonenumber-js --save
$ npm install ngx-mat-intl-tel-input --save
Add NgxMatIntlTelInputComponent
to your component file:
1imports: [NgxMatIntlTelInputComponent];
Refer to main app in this repository for working example.
1<form #f="ngForm" [formGroup]="phoneForm"> 2 <ngx-mat-intl-tel-input 3 [preferredCountries]="['us', 'gb']" 4 [enablePlaceholder]="true" 5 [enableSearch]="true" 6 name="phone" 7 describedBy="phoneInput" 8 formControlName="phone" 9 ></ngx-mat-intl-tel-input> 10</form>
1 2<form #f="ngForm" [formGroup]="phoneForm"> 3 <ngx-mat-intl-tel-input 4 [preferredCountries]="['us', 'gb']" 5 [enablePlaceholder]="true" 6 [enableSearch]="true" 7 name="phone" 8 (countryChanged)="yourComponentMethodToTreatyCountryChangedEvent($event)" // $event is a instance of current select Country 9 formControlName="phone"></ngx-mat-intl-tel-input> 10</form> 11
If you want to show the sample number for the country selected or errors , use mat-hint anf mat-error as
1<form #f="ngForm" [formGroup]="phoneForm"> 2 <ngx-mat-intl-tel-input 3 [preferredCountries]="['us', 'gb']" 4 [onlyCountries]="['us', 'gb', 'es']" 5 [enablePlaceholder]="true" 6 name="phone" 7 formControlName="phone" 8 #phone 9 ></ngx-mat-intl-tel-input> 10 <mat-hint>e.g. {{phone.selectedCountry.placeHolder}}</mat-hint> 11 <mat-error *ngIf="f.form.controls['phone']?.errors?.required" 12 >Required Field</mat-error 13 > 14 <mat-error *ngIf="f.form.controls['phone']?.errors?.validatePhoneNumber" 15 >Invalid Number</mat-error 16 > 17</form>
| Options | Type | Default | Description |
| ------------------ | ---------- | ----------- | ----------------------------------------------------------------------------------- | --- |
| preferredCountries | string[]
| []
| List of country abbreviations, which will appear at the top. |
| onlyCountries | string[]
| []
| List of manually selected country abbreviations, which will appear in the dropdown. | |
| inputPlaceholder | string
| undefined
| Placeholder for the input component. |
| enablePlaceholder | boolean
| true
| Input placeholder text, which adapts to the country selected. |
| enableSearch | boolean
| false
| Whether to display a search bar to help filter down the list of countries |
| format | string
| default
| Format of "as you type" input. Possible values: national, international, default |
| describedBy | string
| undefined
| Use aria-described by with the input field |
./projects/ngx-mat-intl-tel-input
./src/lib
with new functionality.$ npm run build_lib
$ npm run copy-files
$ npm run npm_pack
$ npm run package
After building and creating package, you can use it locally too.
In your project run:
$ npm install --save {{path to your local '*.tgz' package file}}
No vulnerabilities found.
No security vulnerabilities found.