Reputation: 39
i am getting data from server in form of token in controller named "adminSearchCtrl" and want to use that token to another controller named "adminViewCtrl" how to do that??
adminSearchCtrl.js
$scope.getUserDetails = function(selectedUser){
console.log(selectedUser, userToken.token);
AdminSearchService.getUserDetails(selectedUser, userToken.token)
.then(function(response){
$scope.switchUserToken = response.switchToken.token;
})
.catch(function(err){
$scope.error = err.message;
});
}
i want to use this token "$scope.switchUserToken" to another controller named "adminViewCtrl" I have put to $scope also but when i am using "$scope.switchUserToken" to my "adminViewCtrl" it is giving undefined can any body help me out??
Upvotes: 0
Views: 84