AngularJS factory and JSON code

I am following document: 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(“”).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;