ng2-tel-input
Version:
An Angular 2 wrapper for intl-tel-input library
1 lines • 2.43 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],e):e((t=t||self).Ng2TelInput={},t.core,t.common)}(this,function(t,n,e){"use strict";var r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},i=(o.prototype.ngOnInit=function(){var t=this;e.isPlatformBrowser(this.platformId)&&(this.ng2TelInputOptions=r({},this.ng2TelInputOptions,{utilsScript:this.getUtilsScript(this.ng2TelInputOptions)}),this.ngTelInput=window.intlTelInput(this.el.nativeElement,r({},this.ng2TelInputOptions)),this.el.nativeElement.addEventListener("countrychange",function(){t.countryChange.emit(t.ngTelInput.getSelectedCountryData())}),this.intlTelInputObject.emit(this.ngTelInput))},o.prototype.onBlur=function(){var t=this.isInputValid();if(t){var e=this.ngTelInput.getNumber();this.hasError.emit(t),this.ng2TelOutput.emit(e)}else this.hasError.emit(t)},o.prototype.isInputValid=function(){return this.ngTelInput.isValidNumber()},o.prototype.setCountry=function(t){this.ngTelInput.setCountry(t)},o.prototype.getUtilsScript=function(t){return t.utilsScript||"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/16.0.1/js/utils.js"},o.decorators=[{type:n.Directive,args:[{selector:"[ng2TelInput]"}]}],o.ctorParameters=function(){return[{type:n.ElementRef},{type:String,decorators:[{type:n.Inject,args:[n.PLATFORM_ID]}]}]},o.propDecorators={ng2TelInputOptions:[{type:n.Input,args:["ng2TelInputOptions"]}],hasError:[{type:n.Output,args:["hasError"]}],ng2TelOutput:[{type:n.Output,args:["ng2TelOutput"]}],countryChange:[{type:n.Output,args:["countryChange"]}],intlTelInputObject:[{type:n.Output,args:["intlTelInputObject"]}],onBlur:[{type:n.HostListener,args:["blur"]}]},o);function o(t,e){this.el=t,this.platformId=e,this.ng2TelInputOptions={},this.hasError=new n.EventEmitter,this.ng2TelOutput=new n.EventEmitter,this.countryChange=new n.EventEmitter,this.intlTelInputObject=new n.EventEmitter}var u=(s.forRoot=function(){return{ngModule:s,providers:[]}},s.decorators=[{type:n.NgModule,args:[{declarations:[i],exports:[i]}]}],s);function s(){}t.Ng2TelInput=i,t.Ng2TelInputModule=u,Object.defineProperty(t,"__esModule",{value:!0})});