Access to prestashop API by Ionic (AngularJS) denied


#1

I want to get my data in JSON from my Prestashop API with this code.

$http.get("http://2GHG8JA7I4IX43CSMU98L6CEXI7J4WDJ@onefantasticshop.com/api?io_format=JSON").success(function (data, status, headers, config) {
  $scope.success = "success";
  $scope.categoriesId = response.data;
}).error(function (data, status, headers, config) {
  $scope.success = "fail";
});

But when I try to display my result in the following view I only get “fail”.

<ion-content>
  {{success}}
  <ion-list>
    <ion-item ng-repeat="Id in categoriesId" href="#/app/categories/{{Id}}">
      {{Id}}
    </ion-item>
  </ion-list>
</ion-content>

In the browser’s console I have a “Error: Access to restricted URI denied”.

But if I try to access the data through the browser with the URL used in my code, that works.

What should I do to make it work ?


#2

how manage connection online and offline?when open the app