Using return of an Angularjs method in another controllerJS

Asked

Viewed 21 times

1

I have this method in my controllerJS script and would need to use the Response of this method in another controllerJs.

How do I do ?

app.controller("loginController", function($scope, $http, $location){

$scope.usuarios = {};

        $scope.autenticar = function() {    

                $http.post("/usuarioLogadoPermissoes", $scope.usuarios).then(
                        function(response) {
                            $scope.usuarios = response.data;
                            var jsonAux = JSON.stringify(response.data);
                            localStorage.setItem("usuarioLogado",jsonAux);                                  
                        },
                        function(response) {
                            console.log(response);
                        });

            };  
});

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.