I have 2 controllers, loginCtrl and regCtrl, there is a function inside the login controller $scope.login and i want to call this function from inside my regCtrl. What i am trying to achieve is to redirect an user to his homepage without need for login after successful registration. Login function in loginCtrl
$scope.login=function(){
NProgress.start();
singInClicked = true;
var request =$http({
withCredentials: true,
method:"post",
url: "http://localhost:1337/auth/login",
data: {
user_identifier: $scope.user_identifier,
password: $scope.password
}
});
and the code of the regCtrl where i want to call this function is
request.success(
function(data){
$scope.response=data;
console.log("you have registered successfully");
//serviceStatus($http);
//**call $scope.login here**
NProgress.done();
});
How do i achieve this?