@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