Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49142

Http Get Request to Factory

$
0
0

@anicacute09 wrote:

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.id = data.id;
             $scope.username = data.username;
             $scope.role = data.role;
             $scope.date_created = data.date_created;
             $state.go('lounge');
         })
         .error(function (data) {
             alert("Something Went Wrong");
         });
}

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49142

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>