UNPKG

ng-phone

Version:

Avoids UnhandledPromiseRejectionWarning and PromiseRejectionHandledWarning

49 lines (36 loc) 4.25 kB
## Installation ### Install Dependencies `$ npm i ng-phone` `$ npm install google-libphonenumber --save` `$ ng add ngx-bootstrap` ### Install This Library `$ npm install ng-phone --save` ## Usage ### Import Add `NgPhoneModule` to your module file: ```javascript imports: [NgPhoneModule]; ``` ## Example `<ng-phoneCode></ng-phoneCode>` ## Options | Options | Type | Default | Description | | ------------------------ | ------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------- | | enablePlaceholder | `boolean` | `true` | Input placeholder text, which adapts to the country selected. | | customPlaceholder | `string` | `None` | Custom string to be inserted as a placeholder. | maxLength | `number` | `None` | Add character limit. | <!-- | cssClass | `string` | `control-form` | Bootstrap input css class or your own custom one. --> <!-- | numberFormat | `<PhoneNumberFormat>` | `PhoneNumberFormat.International` | Custom string to be inserted as a placeholder. | | searchCountryFlag | `boolean` | `false` | Enables input search box for countries in the flag dropdown. | | searchCountryField | `<SearchCountryField>[]` | `[SearchCountryField.All]` | Customize which fields to search in, if `searchCountryFlag` is enabled. Use `SearchCountryField` helper enum. | | searchCountryPlaceholder | `string` | `'Search Country'` | Placeholder value for `searchCountryField` | --> <!-- | preferredCountries | `<CountryISO>[]` | `[]` | List of countries, which will appear at the top. | | onlyCountries | `<CountryISO>[]` | `[]` | List of manually selected countries, which will appear in the dropdown. | | enableAutoCountrySelect | `boolean` | `true` | Toggle automatic country (flag) selection based on user input. | --> | <!-- | selectFirstCountry | `boolean` | `true` | Selects first country from `preferredCountries` if is set. If not then uses main list. | | phoneValidation | `boolean` | `true` | Disable phone validation. | | inputId | `string` | `phone` | Unique ID for `<input>` element. | | selectedCountryISO | `<CountryISO>` | `None` | Set specific country on load. | | separateDialCode | `boolean` | `false` | Visually separate dialcode into the drop down element. | | countryChange | `<Country>` | `None` | Emits country value when the user selects a country from the dropdown. | -->