0.0.4 • Published 4 years ago

ui-phone-input v0.0.4

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

ui-phone-input

npm version

A simple @angular/ionic based phone input component

Install

npm install ui-phone-input --save

or

yarn add ui-phone-input

Usage

Import the UiPhoneInputModule in your Module

import { UiPhoneInputModule } from 'ui-phone-input';

@NgModule({
  imports: [UiPhoneInputModule],
})
export class Module {}

Use ui-phone-input component in your template

<ui-phone-input
  [value]="phoneNumber"
  (ionChangePhoneNumber)="phoneNumber = $event"
  (ionChangeValidity)="isValid = $event"
  (ionChangeCountry)="country = $event"
  placeholder="(631) 888-8888"
>
</ui-phone-input>

API

Inputs

@InputPurposeType
valueThe telephone numberstring
placeholderInput placeholderstring
countryCountry ISO codestring (2 character ISO code, defaults to 'US')
noResultsTextText to be displayed when searching countriesstring (Defaults to 'No Results')

Outputs

@OutputPurpose
ionChangePhoneNumberTriggered when the phone number changes value and can be parsed.
ionChangeCountryTriggered when the country changes value.
ionChangeValidityTriggered when the phone number validity changes.

Features

  • Emoji Based Flag Support
  • Emits parsed phone number with country code
  • Emits ISO country code
  • Automatic search when country dialog is open. Just type to search.

Nice to Haves / TODOS

  • Test coverage
  • A11y audit (keyboard controls, etc..)
  • Additional internationalization coverage