Http Get Request to Factory

Hi guys, I manage to make a function to get data from my rest api using get request. My problem now is how can I pass data to other views or controllers in order to display to other page. I search and found out you can do this by using factory. How can I use factory for Http Get. By the way this is my code for http get:

$scope.details = {};
$scope.getData = function () {
    $http.get("http://localhost/colombiandreamdate/v1/userlogin", { params: { username: $scope.details.username, password: $scope.details.password } })
         .success(function (data) {
             $ =;
             $scope.username = data.username;
             $scope.role = data.role;
             $scope.date_created = data.date_created;
         .error(function (data) {
             alert("Something Went Wrong");

try to use localStorage guys

I need a remote android app to use as a mobile version of my website. So i need to get data from the server…

oh, how about save data in $rootScope ?!

yah i think about that too, but as i read one of this post It is much better to use factory instead of $rootscope