Having an issue with passing data from rootScope.reslogin2 to scope.user. It's not displaying as expected, here is my JavaScript file:
app.controller("logincont", ['$scope','$http','md5','$window','$rootScope',function($scope,$http,md5,$window,$rootScope){
$scope.$watch('pass', function(val) {
$scope.password = md5.createHash($scope.pass || '');
});
$scope.cari = function () {
$http.get('http://localhost:8089/MonitoringAPI/webresources/login?a='+$scope.userid+'&d='+$scope.password).then(function(response){
$scope.reslogin = response.data;
$rootScope.reslogin2 = response.data[0].username;
$scope.reslogin3 = response.data[0].lsmenu[0].idmenu;
console.log($scope.reslogin);
console.log($scope.reslogin2);
});
};
}]);
app.controller("moncont", ['$scope','$http','$filter','$rootScope',function($scope,$http,$filter,$rootScope){
$scope.user = $rootScope.reslogin2;
console.log($scope.user);
}]);
Want the content of
<p>Username : {{user}}</p>
to display properly.