I am setting a scope variable in one controller, then changing location to another view. Then in the controller of the new view the scope variable is no longer accessible, it states it is 'undefined'. I have added a simplified version of the problem below and would appreciate any help.
app.controller('loginController', function ($scope,$location){
$scope.loginUser = function (user) {
$scope.userId = "USERID";
$location.path('/view3');
}
});
Controller for view 3
app.controller('videoListController', function($scope){
alert("UserID: "+$scope.userId);
});
The value of $scope.userId
appears as 'undefined
'. What am I doing wrong?