1.1.0 • Published 2 years ago

ngx-international-number v1.1.0

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

Intro

This library is for International Phone Number Validation for Angular using Directive. It supports both Template driven and Reactive Forms.

libphonenumber-js is used for the Phone Number validation.

Demo

Usage

  1. npm i ngx-international-number

  2. Add InternationalPhoneModule import to your NgModule (where the directive is used) like this:

    import { NgxInternationalNumberModule } from "ngx-international-number";
    
    @NgModule({
      imports: [NgxInternationalNumberModule],
    })
    export class AuthModule {}
  3. Add the Directive to you Phone Number Input like this:

    <input
     type="tel"
     formControlName="phoneNumber"
     international-number
     defaultCountry="PK"
     (countrySelected)="countryChanged($event)"/>

Inputs

NameTypeDefaultDescription
searchPlaceHolderstring?nullThe Placeholder for the search input
defaultCountrystring?nullAlpha 2 Country Code
huestring?212HSL color Hue value for customizing theme
customScrollbarboolean?trueUse false to disable theming for scrollbar

Outputs

NameParametersDescription
countrySelectedcountry: CountryEmits whenever there is a change in country selected including the default country
dropdownOpeneddidOpen: booleanEmits whenever dropdown is toggled

Styling

  • dropdown-open class is added on the root element of country select when dropdown is open for custom styling

Sources

Flags used are from this Package

The Countries Data was copied form this Github Repo

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.9.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.8.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago