Hello to all, welcome to therichpost.com. In this post, I will solved – intlTelInput is not a function.
From last couple of months, I am getting questions from my blog and youtube viewers that, during implement input phone number with country code, they are facing many error like below:
- window.intlTelInput is not a function
- intlTelInput is not a function
- ERROR TypeError: ctx.telInputObject is not a function
Here is the proper tutorial to add input type phone number into your angular 9 application but you need to replace the component.html file with my code and that code I have mentioned in the end:
1. Here is the code, you just need to replace:
<input type="text" ng2TelInput (hasError)="hasError($event)" (ng2TelOutput)="getNumber($event)" (intlTelInputObject)="telInputObject($event)" (countryChange)="onCountryChange($event)" /> //You need to remove all the functions because first you have to declare them all in component.ts file ----To---- //For using default events you just need to declare functions into your component.ts file as well <input type="text" ng2TelInput />
If you are still facing issue then please comment below.
jassa
Thank you
Hi, Im getting an error as shown as below, Im using angular 8
Refused to apply style from ‘http://localhost:4200/path/to/intlTelInput.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
can u pls help?
Hi Lynn, did you follow this tutorial and i think you have not applied styles:
https://therichpost.com/angular-8-input-phone-number-with-country-code/
how to set 90 country code and 05552456800 to number field. I want to initialize this with these values. But how? thank you
Hi, you want default 90?
Imagine when you visit the page you see indian flag is set and number is 05552456800 , how can i set these variables into the object.
I mean I want to set country code when I initialize the object. 90 is Turkey ‘s country code.
Here is the code:
add this attribute inside input
[ng2TelInputOptions]=”{initialCountry: ‘in’}”
how can i change dynamical value for country code
Yes, you can. you need to define that value into your controller file.
Thank you
How will i get the value concating country code and number
For this, you need to call input onchange event.
can i use this with formly angular 7
Yes you can
Hi, Im getting same error vendor.js:1824 ERROR Error: Uncaught (in promise): TypeError: window.intlTelInput is not a function ..please help
Hi, can you please show me your code?
I have followed your step one by one but getting the same issue.
intltelinput function not found.
type of text/html (Refused to apply style from ‘http://localhost:4200/node_modules/intl-tel-input/build/css/intlTelInput.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.)
ERROR TypeError: window.intlTelInput is not a function
plz help
Did you follow this:
https://therichpost.com/angular-8-input-phone-number-with-country-code/
yes, sir.
I have followed the same step given in this URL.In my angular 5 version projects.
Your are doing in angular 5? very old, right now angular 9 is running.
but my project on angular 5.Plz suggest
Angular 5 is older version, please do project in Angular 9.
that is not my project it is my client (office) project which is running on angular 5 so that I am getting an issue and I didn’t find other packages dependency.
Yes you are right then you can use some other jquery library for input with country selection.
thanks .. now it’s working on my same project but how validate the number country wise.
and save that data with fromControlName.
How to use with ngx formly angular can u give solution
I will update you on this.
Hi, I am using angular 8 version but get some error.
window.intlTelInput is not a function
Did you follow my complete tutorial?
in local its working fine, after the move to live its coming error.
it works. Thanks a lot!!!!
Great 🙂
Hi is there any option for search country field
Hi, i need same functionality in angular 9 using ag-grid. Is it possible
Yes
Hi, I am setting the number for inttelinputobject, here countrycode with flag is coming but I am not getting phonenumber in input field
Hi Thank you for the reply can you please provide the code(property for searching the country using intltelinput) so that i can implement it in my application
How do I seperate a country code from phonenumber?
Can you explain it bit more?
I am having a input field of type tel it contains both country code with flag and phonenumber field, so while I am saving the number I am sending both countrycode and phonenumber in one string, while I am editing the page I am getting phonenumber as both countrycode and phonenumber.
so I need to set the number what I get, while setting the number by using setNumber() only country code is setting, phone number is not setting
Okay, I will check and update you. Thanks
Add utils.js in scripts,
`”scripts”: [
“node_modules/intl-tel-input/build/js/utils.js”
]`
in angular.json file. This will solve your issue.
1. goto angular.json file
2. look for scripts
3. add “node_modules/intl-tel-input/build/js/utils.js” inside the scripts along with the intlTelInput.min.js / intlTelInput.js
4. save
5. refresh your application
Great.
its works only locally but when we try to build in server and load it it will how same error
You must have some undefined function.
Hey,Ng2-tel-Input in not working with angular 12
Can you please tell me your error in console?