$http request not working

Hi,

I’m new to ionic but I love the framework.
I’m trying to create an app and I’m using the Yahoo! finance API to receive some data.
I’m using the angular $http.get method and everything works great when I test it on my browser.
When I test it on android virtual environment or on my real phone, the app stuck after the $http.get request and doesn’t return a promise…

I guess it has something to do with ionic or maybe I’m missing something?

Thank!

Hi,

Can you share your code?

Hi,

Sure, I’m just trying to call a async call using the yahoo finance api

$http.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDEUR%22%29&env=store://datatables.org/alltableswithkeys&format=json")
    .then(function(data) {
       
        $scope.currencyResult = data.data.query.results.rate.Rate;                       
    });

For some reason when I try to build the apk using the ionic command, I receive an error, so I used the phonegap command and the build worked. Is it has something to do with that?

Thanks

This is very strange.
It should be work.
What is the error?

I thought so too…
I receive 404 error

I copied the error details:

image

thanks

Just for testing purposes can you try with this: http://codepen.io/Vatsov/pen/WrEavb

Hi,

I figured it out… just needed to add the cordova whitelist plugin (in cordova/phonegap its added by default)

Thanks