Reputation: 4484
I have a strange problem here.
I am working on a Ionic (AngularJS) project and using jQuery in one of my controllers, so need to add the reference to it in index.html
If I add reference like this -
<!-- jQuery js -->
<script type="text/javascript" src="lib/jquery/jquery-2.1.3.min.js"></script>
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
then, I get below error from one of the views -
Error: [$compile:ctreq] Controller 'ionTabs', required by directive 'ionTabNav', can't be found!
But, If I add reference like this -
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- jQuery js -->
<script type="text/javascript" src="lib/jquery/jquery-2.1.3.min.js"></script>
then, I get below error from another one of the controllers, which was the reason I included jQuery in the first place -
Error: [jqLite:nosel] Looking up elements via selectors is not supported by jqLite!
Not sure how to resolve this? I need to get both functionalities working.
Thanks in advance.
Upvotes: 2
Views: 14441
Reputation: 1384
You need to use jQuery Lite. Read more at https://docs.angularjs.org/api/ng/function/angular.element
Upvotes: 0
Reputation: 803
Looks like this is a conflict between ionic and certain versions of jQuery . https://github.com/driftyco/ionic/issues/1976 - switching the version of jQuery you are using should resolve.
Upvotes: 3
Reputation: 709
I have a feeling that the problem here is not with a conflict between ionic (per se) and jQuery, but an issue with Angular and jQuery.
Angular comes with a jQlite version of jQuery and that's probably what is conflicting. You might get some more information from this post on the Ionic Forum.
Sorry I can't be more helpful, I'm only just starting out on my ionic adventures myself.
Upvotes: 1