Problem with my REST


#1

hi everyone.

I have a problem with my Service Rest, not working in my emulator devices. but in my local host working well, like this

in my emulator devices not working well, like this

my code is this:
ionic.project file
{
“name”: “zupaios”,
“app_id”: “”,
“proxies”: [{
“path”: “/zupa”,
“proxyUrl”: “http://web.zupa.delivery/webservice/index.php/
}]
}

serveces.js file
(function(){
var zupaio = angular.module(‘zupaio.zupafactoryio’, [‘ngCordova’]);

zupaio.factory('zupafactoryio',function($http,$cordovaSQLite,ZupaPoint){

    var storeShop = [];
    var storeProducts = [];

    db = window.openDatabase("zupas.db", "1.0", "Data Base ZUPA-PHONE", 200000);

    return {
        ZupaListCategory:function(){
            return $http.get('/zupa/categories');
        }, 
      }
// other functions

}
})();

controller.js file

// list all categories
zupaio.controller(‘ListCategoryCtrl’, function($scope,$http,zupafactoryio,$ionicLoading,$timeout) {

    $scope.loading = $ionicLoading.show({
        content: '<ion-spinner icon="android"></ion-spinner>',
        animation: 'fade-in',
        showBackdrop: false,
        maxWidth: 50,
        showDelay: 0
    });

    $timeout(function () {
        zupafactoryio.ZupaListCategory().then(function(categories){ // CHARGE ALL CATEGORIES
            $scope.categories = categories.data;
            categoriesvar  = categories.data;

        });
        $ionicLoading.hide();
    }, 3000);

});

please help me I don’t know why not show me in my emulator devices, but in local host working well
or I need to install a plugin

thank for your attention.


#2

Hi,
Don’t use your proxy link when you use the emulator or your real device.
use: $http.get('http://web.zupa.delivery/webservice/index.php/categories');
instead of: $http.get('/zupa/categories');
I hope that this would be helpful.


#3

but when device is offline what
as they manage?


#4

it’s working thank you very much