Import

import-phone-field.ts
import { nuiFormatPhone, NuiPhoneField } from '@needless-ui/angular/phone-field';

NuiPhoneField

A phone number field.

Selector
nui-phone-field
NuiPhoneField: Properties
NameTypeDefaultDescription
valueTwo-waystring (E.164)''The number in E.164, or empty.
countryTwo-waystringthe locale's regionThe country, as its region code.
countriesInputstring[]allThe countries offered, as region codes.
localeInputstringLOCALE_IDThe language of country names.
labelInputstringNames the number, when no <label for> does.
inputIdInputstringThe number’s id, for <label for>.
placeholderInputstringThe number’s placeholder.
invalidInputbooleanfalseMarks the number invalid.
disabledInputbooleanfalseIt can’t be changed.
labelsInputPartial<NuiPhoneFieldLabels>Every text it says, to translate.

Helpers

Functions for phone numbers.

Helpers: Properties
NameTypeDefaultDescription
nuiParsePhoneMethod(text, region?) => NuiPhoneNumber | nullReads a number written any way into its region, calling code and national number.
nuiFormatPhoneMethod(phone, style?: 'international' | 'e164') => stringWrites a number grouped as its country does, or in E.164.
nuiPhoneValidMethod(phone, region?) => booleanWhether a number has a known calling code and its country’s length.