I am compiling an Ionic version 1 App to a device.
When i run ionic serve on the browser i can search and get a search result as the return.
I am using an http.post:
$http.post("http://www.example.com/myapi/mysearch.php", $scope.formData )
.success( function(data) {
After installing on the smartphone all i got is an error message (error).
I think this can be a lack of the whitelist cordova plugin, wich i do remove and reinstall again .
Also have added : <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
To the index.html file.
How can i enable the apk to make post requests to the API ?
Debugging from the real device using Chrome tools return this error message:
Failed to load http://www.myexample.com/api/myexampleapi.php:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
Here is my Ionic info:
Ionic:
ionic (Ionic CLI) : 4.1.2 (C:\Users\myuser\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic1 1.1.0
@ionic/v1-toolkit : 1.0.8
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : none
Cordova Plugins : not available
System:
NodeJS : v8.10.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 7
Environment: