1

i am trying to build a mobile app, but i need some jQuery functions to make it function. at first i thought nothing was wrong since i am debugging it using ionic serve on firefox and everything seems to function. all interface runs smooth and jquery commands executing properly. but when i compiled the app and installed it on my android device. the jquery functions seems to not respond.

i embedded a CDN for the jQuery

<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"> </script>

i hope somebody can help me out here.

5
  • if you include the jquery file in your project does it still gives the same error? Commented Aug 20, 2015 at 11:27
  • 2
    You shouldn't use jQuery with Ionic/Angular cause you shouldn't manipulate the DOM with jQuery but use angular directives instead. More info here. Commented Aug 20, 2015 at 11:52
  • @Miguel, yes is still does. Commented Aug 20, 2015 at 12:00
  • @LeftyX, so in short AngularJS and jQuery doesn't mix together ? Commented Aug 20, 2015 at 12:01
  • 1
    @TheBloodShed: Yes. I would suggest not using jQuery and go for angular directives. Ionic is build on top of AngularJs and defines directives and modules. You can find angular modules for pretty much everything. Commented Aug 20, 2015 at 12:05

1 Answer 1

2

Since you have used a CDN for jQuery the application makes a http request to retrieve the js file when its run. This happens in background when you run the application on the browser with ionic serve. But when you run it on a mobile device it needs to have special permissions configured to make the required http requests.

White listing the domain using the cordova-plugin-whitelist will solve the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.