1

I am new to ionic application development. I am just using ionic sample project from their site. But the problem is that it works fine in browser. But not load data from server on device.

Error message shows

Failed to load resource: the server responded with a status of 404 (Not Found)

Azat
  • 6,745
  • 5
  • 31
  • 48
SHIBU JOSEPH
  • 11
  • 1
  • 2
  • What are you trying? It looks like the server isn't getting the requests properly. – Keval Apr 29 '15 at 08:09
  • Google, setting proxy for live reload on your device. I probably think its a cross domain issue. – Karan Kumar Apr 29 '15 at 08:36
  • If server is running in localhost, try giving your ip in the url where the connection to server is specified. – paje007 Apr 29 '15 at 09:52
  • Thanks,its not the error in the code.because code is working code which i downloaded from a working sample project.the problem i think is in ionic install.or when i update cordova to 5.0 – SHIBU JOSEPH Apr 29 '15 at 11:36
  • Okay, so like Ophir linked you to an answer, you should try adding the plugin. I recently answered a question here - http://stackoverflow.com/a/29916802/4412363. Let me know if the same steps works for you. – Keval Apr 30 '15 at 06:03

1 Answers1

7

Given I can't just add comment (sad but true), I'll use a full blown answer. Take a look at the answer I published here, looks like it could be the same issue: https://stackoverflow.com/a/29953668/4509672

Highlights from it:

Depending on your Cordova version, as seen at Cordova Android 4.0.0 announcement, since Cordova 4.0.0 it could be you must add the cordoba-

Whitelist functionality is revamped

  • You will need to add the new cordova-plugin-whitelist plugin to continue using a whitelist
  • Setting a Content-Security-Policy (CSP) is now supported and is the recommended way to whitelist (see details in plugin readme)
  • Network requests are blocked by default without the plugin, so install this plugin even to allow all requests, and even if you are using CSP.
  • This new whitelist is enhanced to be more secure and configurable, but the Legacy whitelist behaviour is still available via a separate plugin (not recommended).
  • Note: while not strictly part of this release, the latest default app created by cordova-cli will include this plugin by default.
Community
  • 1
  • 1
Ophir Stern
  • 1,277
  • 12
  • 22
  • I have no idea why you got a down-vote earlier. But after a day of finding nothing I finally hit your post and my problems were solved! Thanks a lot :) – Mudit Jaju May 06 '15 at 21:48
  • To tell you the truth, I don't really know either, but having the same problem in the past I know it was a pain, and its great to hear it solved yours, thanks for the up-vote :) – Ophir Stern May 08 '15 at 12:40