How to pass data using HTTP service call in an ionic project


#1

i want to pass data using HTTP service call to the ionic project that am working with how to create a service request method to get data using HTTP ?


#2

Use the AngularJS $http service.


#3

hope this piece of code helps you

.controller(‘Ctrl’,[’$scope’,’$http’,function($scope,$http){

$scope.contents=null;
$http.get(‘http://www.json-generator.com/api/json/get/cdbaTynvjC?indent=2’).then(function(resp){
$scope.contents=resp.data;
},

function(err){
console.error(‘ERR’,err);
});

}]);