Rest API call from Ionic app

Hi,

I am new to Ionic. I just started developing my 1st app.

I am just making a rest call just to display city list. Intially I have faced CORS problem and I have rsolved it by refering to http://blog.ionic.io/handling-cors-issues-in-ionic/

I have added the proxy block as mentioned below to my ionic.project file.
“proxies”: [
{
“path”: “/renu/api/GetStations/RBKAL/RBKAL”,
“proxyUrl”: “http://124.146.119.122/renu/api/GetStations/RBKAL/RBKAL
}
]

Below is my controller code where I am making rest call
$http({
method : “GET”,
//url : "http://localhost:8100/renu/api/GetStations/RBKAL/RBKAL"
url: “file://renu/api/GetStations/RBKAL/RBKAL”
}).then(function mySucces(response) {
$scope.selectables = response.data.stationDetails
}, function myError(response) {

});

It works fine with url: "http://localhost:8100/renu/api/GetStations/RBKAL/RBKAL while running throught ionic serve. But when I change the url to file://renu/api/GetStations/RBKAL/RBKAL to genereate apk file to deploye it under andriod device as suggested in http://blog.ionic.io/handling-cors-issues-in-ionic/. It’s not working. So if anyone knows how to reframe the URL while generting the apk file, guide me to solve this issue.

Regards,
Navaneeth

After googling it for 2 days I have found the solution.
Just install Cordova Whitelist plugin to your project directory then build the apk file. It worked for me.

ionic plugin add GitHub - apache/cordova-plugin-whitelist: [DEPRECATED] Apache Cordova - Whitelist Plugin

Refer: Ionic Docs - Ionic Documentation