Open haneefatel opened 7 years ago
Hello @haneefatel, If you found the solution, would you share it here. Thanks in advanced
No, I couldn't find the solution. Most of the answers posted on this issue is pointing to the order of jQuery loads in the application https://github.com/hodgepodgers/ng-intl-tel-input/issues/39
I checked and confirmed that jQuery is loaded in my application before angular loads & jqLite is not. See above console.
@haneefatel do you have a github repo where i can review how the code is being used?
@SyntaxStacks I don't have a github repo for this project as it is coded for organization and they have their own server to deploy the code.
The project configured using webpack and gulp. My webpack.js contains
// Global jQuery for AngularJS
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }),
this loads jQuery, it is confirmed.
It's hard to say without context. If you're using jquery in place of jqlite, providing jqLite: 'jquery'
in the webpack.ProvidePlugin
will define that for you, but could cause have unintended consequences
I m getting this ...could u plz help me.. Error: a.intlTelInput is not a function a.$get</<.init.value@http://localhost:8000/client/lib/ng-intl-tel-input/dist/ng-intl-tel-input.min.js:1:379 .link@http://localhost:8000/client/lib/ng-intl-tel-input/dist/ng-intl-tel-input.min.js:1:970 ab/<@http://localhost:8000/client/lib/angular.min.js:16:69 la@http://localhost:8000/client/lib/angular.min.js:81:90 p@http://localhost:8000/client/lib/angular.min.js:66:341 g@http://localhost:8000/client/lib/angular.min.js:58:481 p@http://localhost:8000/client/lib/angular.min.js:66:281 g@http://localhost:8000/client/lib/angular.min.js:58:481 g@http://localhost:8000/client/lib/angular.min.js:58:498 p@http://localhost:8000/client/lib/angular.min.js:66:281 g@http://localhost:8000/client/lib/angular.min.js:58:481 g@http://localhost:8000/client/lib/angular.min.js:58:498 g@http://localhost:8000/client/lib/angular.min.js:58:498 aa/<@http://localhost:8000/client/lib/angular.min.js:58:119 A/<.compile/<@http://localhost:8000/client/lib/angular-ui-router.min.js:7:24507 ab/<@http://localhost:8000/client/lib/angular.min.js:16:69 la@http://localhost:8000/client/lib/angular.min.js:81:90 p@http://localhost:8000/client/lib/angular.min.js:66:341 g@http://localhost:8000/client/lib/angular.min.js:58:481 aa/<@http://localhost:8000/client/lib/angular.min.js:58:119 ac/<@http://localhost:8000/client/lib/angular.min.js:63:37 l@http://localhost:8000/client/lib/angular-ui-router.min.js:7:23498 z/l.compile/</<@http://localhost:8000/client/lib/angular-ui-router.min.js:7:23918 vf/this.$get</m.prototype.$broadcast@http://localhost:8000/client/lib/angular.min.js:148:182 w/z.transitionTo/z.transition<@http://localhost:8000/client/lib/angular-ui-router.min.js:7:19060 e/<@http://localhost:8000/client/lib/angular.min.js:131:20 vf/this.$get</m.prototype.$eval@http://localhost:8000/client/lib/angular.min.js:145:343 vf/this.$get</m.prototype.$digest@http://localhost:8000/client/lib/angular.min.js:142:412 vf/this.$get</m.prototype.$apply@http://localhost:8000/client/lib/angular.min.js:146:111 l@http://localhost:8000/client/lib/angular.min.js:97:320 J@http://localhost:8000/client/lib/angular.min.js:102:34 gg/</t.onload@http://localhost:8000/client/lib/angular.min.js:103:4
The key is to include jQuery before Angular.
Also, make sure to include intl-tel-input.min.js
and utils.js
from https://github.com/jackocnr/intl-tel-input and the css/img files.
There is absolutely nothing in the documentation about using the utils.js file. I understand that it's necessary, but where am I supposed to get it, why isn't it included or referenced in any way throughout the documentation, and how was anyone to know without looking through "open issues?" No offense, I'm just confused about why this wouldn't have been previously brought up in some way.
I got the utils file from:
bower_components/intl-tel-input/build/js/utils.js
I understand that, I am just stating that the actual documentation for this should be updated to tell people how to make this work. I would not have known to get that file without reading open issues. You also need the flag images and the css from intl-tel-input as well.
I agree that either the documentation should mention it, or they should be included in the downloaded bower/npm package.
had this issue today. i had to place jquery before angular and then it worked.
Had same issue, using webpack. Had to configure ProvidePlugin like this:
new webpack.ProvidePlugin({ $: 'jquery', 'window.jQuery': 'jquery'})
Note the 'window.jQuery', not just 'jQuery'!
See here for explanation:
I had to include all the following dependencies in given order for it to work for me.
<link rel="stylesheet" href="bower_components/intl-tel-input/build/css/intlTelInput.css">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/ng-intl-tel-input/dist/ng-intl-tel-input.js"></script>
<script src="bower_components/intl-tel-input/build/js/intlTelInput.js"></script>
<script src="bower_components/intl-tel-input/build/js/utils.js"></script>
Not Angular related but this issue (top comment) helped me. I'm using webpack and had the same problem (...not a function) with several components i was trying to use. Seams like webpack is giving me a hard time with everything..
Since i'm using webpack, and rely on requires instead of Githubissues.
I have following error, and I checked the order of loading jQuery and angular. It is fine(jQuery loads first) as I have used webpack provide plugin to use jQuery instead jqLite. Please see the console below
`TypeError: elm.intlTelInput is not a function at Object.value (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:117052:18) at Object.link (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:117075:27) at http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:25040:19 at invokeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:33727:10) at nodeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:33128:12) at compositeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:32413:14) at compositeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:32416:14) at nodeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:33123:25) at compositeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:32413:14) at nodeLinkFn (http://localhost:5000/app/common.js?029d67a20ccf00d48ee4:33123:25)
<input type="{{type}}" ng-intl-tel-input="" ng-blur="onBlur()" ng-change="onChange()" ng-model="value" ng-model-options="ngModelOptions" ng-disabled="disabled" ng-readonly="checked" "="" class="ng-pristine ng-untouched ng-valid">`
jqLite
VM4267:1 Uncaught ReferenceError: jqLite is not defined(…)(anonymous function) @ VM4267:1
$
$(selector, [startNode]) { [Command Line API] } angular.element ( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return …