@serene-dev/ng-tel-input
Version:
This is a wrapper for [intl-tel-input@ 23.0.10](https://github.com/jackocnr/intl-tel-input)
91 lines (88 loc) • 3.84 kB
TypeScript
import * as intl_tel_input_data from 'intl-tel-input/data';
import * as _angular_core from '@angular/core';
import { ElementRef } from '@angular/core';
import { Iti, SomeOptions } from 'intl-tel-input';
/**
* Directive to validate input of telephone numbers
*/
declare class NGTelInputDirective {
/**
* Reference to the input element.
*/
elementRef: ElementRef<HTMLInputElement>;
private platformId;
/**
* Path to intl-tel-input js script.
* IF you wish to import the script outside the directive, you can set this field as undefined or null.
*/
readonly scriptPath: _angular_core.InputSignal<string>;
/**
* Path to intl-tel-input utils js script.
*/
readonly utilScriptPath: _angular_core.InputSignal<string>;
/**
* Instance of the intl-tel-input object
*/
instance?: Iti;
/**
* Options that can be provided during initialization.
*/
readonly _ng2TelInputOptions: _angular_core.InputSignal<TelInputOptions>;
/**
* Emits an event when an error occurs.
*/
readonly hasError: _angular_core.OutputEmitterRef<boolean>;
/**
* Emits the current number in the given format (defaults to E.164 standard). The different formats are available in the enum intlTelInputUtils.numberFormat - taken from here. Requires the utilsScript option. Note that even if nationalMode is enabled, this can still return a full international number.
*/
readonly ng2TelOutput: _angular_core.OutputEmitterRef<any>;
/**
* Emits the country data for the currently selected flag.
*/
readonly countryChange: _angular_core.OutputEmitterRef<intl_tel_input_data.Country | {
name?: string;
iso2?: string;
dialCode?: string;
}>;
/**
* Emits the instance of the intl-tel-input object
*/
readonly intlTelInputObject: _angular_core.OutputEmitterRef<any>;
/**
* Computed Options
*/
readonly ng2TelInputOptions: _angular_core.Signal<TelInputOptions>;
/**
* Directive to validate input of telephone numbers
*/
constructor(
/**
* Reference to the input element.
*/
elementRef: ElementRef<HTMLInputElement>, platformId: string);
/**
* initialise the plugin with optional options.
*/
ngOnInit(): Promise<void>;
/**
* Runs validation checks after the content of the input changes.
*/
onBlur(): void;
/**
* Validate the current number. Expects an internationally formatted number (unless nationalMode is enabled). If validation fails, you can use getValidationError to get more information. Requires the utilsScript option. Also see getNumberType if you want to make sure the user enters a certain type of number e.g. a mobile number.
* @returns Boolean
*/
isInputValid(): boolean;
/**
* Change the country selection (e.g. when the user is entering their address).
* @param countryCode — country code of the country to be set.
*/
setCountry(country: string): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NGTelInputDirective, never>;
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NGTelInputDirective, "[ngTelInput]", ["ngTelInput"], { "scriptPath": { "alias": "scriptPath"; "required": false; "isSignal": true; }; "utilScriptPath": { "alias": "utilScriptPath"; "required": false; "isSignal": true; }; "_ng2TelInputOptions": { "alias": "ng2TelInputOptions"; "required": false; "isSignal": true; }; }, { "hasError": "hasError"; "ng2TelOutput": "ng2TelOutput"; "countryChange": "countryChange"; "intlTelInputObject": "intlTelInputObject"; }, never, never, true, never>;
}
/**Telephone inputs custom configuration */
interface TelInputOptions extends SomeOptions {
}
export { NGTelInputDirective };
export type { TelInputOptions };