Import
import { nuiFormatPhone, NuiPhoneField } from '@needless-ui/angular/phone-field';NuiPhoneField
A phone number field.
| Name | Type | Default | Description |
|---|---|---|---|
valueTwo-way | string (E.164) | '' | The number in E.164, or empty. |
countryTwo-way | string | the locale's region | The country, as its region code. |
countriesInput | string[] | all | The countries offered, as region codes. |
localeInput | string | LOCALE_ID | The language of country names. |
labelInput | string | Names the number, when no <label for> does. | |
inputIdInput | string | The number’s id, for <label for>. | |
placeholderInput | string | The number’s placeholder. | |
invalidInput | boolean | false | Marks the number invalid. |
disabledInput | boolean | false | It can’t be changed. |
labelsInput | Partial<NuiPhoneFieldLabels> | Every text it says, to translate. |
Helpers
Functions for phone numbers.
| Name | Type | Default | Description |
|---|---|---|---|
nuiParsePhoneMethod | (text, region?) => NuiPhoneNumber | null | Reads a number written any way into its region, calling code and national number. | |
nuiFormatPhoneMethod | (phone, style?: 'international' | 'e164') => string | Writes a number grouped as its country does, or in E.164. | |
nuiPhoneValidMethod | (phone, region?) => boolean | Whether a number has a known calling code and its country’s length. |