Sunday, 9 October 2016

Post 65: How to load a local file on ionic

I'm using ionic 1.x and I'm assuming the json file lies in the www-folder.

.controller('DashCtrl', function ($scope, $http) {
  $http({method: 'GET', url: 'quotes.json'})
    .success(function(data){
      console.log("success! ", data);
    })
    .error(function(){
      console.log("error!");
    })
    .finally(function(){
      console.log("finally!");
    });
    

No comments:

Post a Comment

Tweet