i am trying to get response of post/get requests , getting response successfully inside post/get,but unable to get result out of post/get . when i print on console it is showing "undefined". any suggestions , here is my code
index.html:
<div ng-app="myApp" ng-controller="customersCtrl">{{ponies}}</div>
Angular code:
var myApp = angular.module('myApp', []);
angular service:
myApp.factory('ponyService', function($http) {
  var getPonies = function() {
    return $http.get('https://www.w3schools.com/angular/customers.php');
  };
  return {
    getPonies: getPonies
  };
});
myApp.controller('customersCtrl', function($scope, ponyService) {
ponyService.getPonies().success(function(data) {
    $scope.ponies = data;
  });
console.log($scope.ponies); // here want to print data because want to use whole controller
});
 
     
    