AngularJS factory and JSON code

I am following document: http://learn.ionicframework.com/formulas/navigation-and-routing-part-2/ for navigation and created factory.

I want to call .get in Angular factory. Can I please have any help why mydata is staying null when i use .get and returns the right values when i add JSON manually statically. I can see in console that json is loading but mydata variable has no value:

.factory(‘People’, function($http) { $http.get(“http://www.example.com/service_2.php”).success(function(response) { var mydata = response;});

Controller is: .controller(‘MContactCtrl’,
function($scope, People) { $scope.values = alert(People.all()); })
and all function: return { all: function() { return mydata;