Anyone know how I give an Android Ionic app permission to make cross-domain $http calls?
I have tried the suggestions mentioned in this post: Ionic + Angular - How to avoid the "404 Not Found (from cache)" after POST request?
I have my Content Security meta tag set to accept everything but my app still won't allow any AJAX calls (AngularJS $http.get
).
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
The error is in the
ionic.bundle.js:17746, error message 'failed'
(no details). The calls I am trying to make are not https.
Works fine in iOS.
Example call:
$http.get(AppConfig.apiHost + "/api/user/",
{params: {user_id: target_user_id}})
.success(function (target_user) { // do something})
.error(function (error) { console.log(error)});
CLARIFICATIONS FROM COMMENTS BELOW
Here is my config.xml: https://gist.github.com/metalaureate/6f8237b673dacc1412c0b928b7a3d9e5
Cordova CLI: 6.0.0 Ionic Version: 1.0.0-rc.0 Ionic CLI Version: 1.7.14 Ionic App Lib Version: 0.7.0 ios-deploy version: 1.8.5 ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v0.12.2 Xcode version: Xcode 7.3 Build version 7D175
Plugins: cordova-plugin-app-event,cordova-plugin-badge,cordova-plugin-camera,cordova-plugin-contacts,cordova-plugin-device,cordova-plugin-file,cordova-plugin-file-transfer,cordova-plugin-image-picker,cordova-plugin-inappbrowser,cordova-plugin-whitelist,cordova-plugin-x-socialsharing,cordova-plugin-x-toast,de.appplant.cordova.plugin.local-notification,phonegap-plugin-push
All AJAX calls fail.
All testing on a real Samsung S4
ng-csp
into your body tag – jcesarmobile