pierre-vigier / intlpnIonic

Simple version of intl-phone number input for Ionic
MIT License
23 stars 23 forks source link

TypeError: intlTelInputUtils.formatNumberByType is not a function #19

Open hassanmirza opened 7 years ago

hassanmirza commented 7 years ago

console error ionic.bundle.js:20306 TypeError: intlTelInputUtils.formatNumberByType is not a function at NgModelController.ngModelCtrl.$render (intlpnIonic.js:296) at Object.ngModelWatch (ionic.bundle.js:31992) at Scope.$digest (ionic.bundle.js:22934) at Scope.$apply (ionic.bundle.js:23205) at bootstrapApply (ionic.bundle.js:10147) at Object.invoke (ionic.bundle.js:12884) at doBootstrap (ionic.bundle.js:10145) at bootstrap (ionic.bundle.js:10165) at angularInit (ionic.bundle.js:10059) at HTMLDocument. (ionic.bundle.js:34824)

pierre-vigier commented 7 years ago

Hi,

did you include : <script src="path/to/lib/libphonenumber/build/utils.js"></script> ?

The intlTelInputUtils symbol is exported by the google libphonenumber library, it seems you don't have it from the look of the message

pierre-vigier commented 7 years ago

no feedback closing

1337 commented 7 years ago

Which utils.js are you talking about? I cannot find formatNumberByType in these files:

The given example http://play.ionic.io/app/6d0a3832cc50 is also broken where national mode is true, throwing the same "intlTelInputUtils.formatNumberByType is not a function" error.

pierre-vigier commented 7 years ago

Hum strange, i did not see it because the functionality is working, i'll check. Next time, add a small description with the problem, it helps :)

1337 commented 7 years ago

I didn't open the issue, hah.

I investigated some more. The utils.js in the 0.1.7 tag seems to have a formatNumberByType method, but it disappeared in 0.1.8.

Even if you bring that utils.js into the 0.1.12 release, the national mode validation will fail because getDialCode will give you the wrong code. For a number like +1 519 555 4567, the dial code returned should be +1 rather than +1 519.

mohdiarra commented 6 years ago

Please try to fix this issue. I'm having to use v.0.1.7 to make this work.

Thanks.

pierre-vigier commented 6 years ago

Fill free to make a pull request :) Help would be appreciated on that topic