-
Notifications
You must be signed in to change notification settings - Fork 583
Open
Labels
Description
Hi
Can anyone tell me why both scope and localstorage values are not synced?
$scope._emptyCredentials = {
'_uid': null,
'_token': null,
'_ts': null
};
$scope.user = {
email: '',
password: ''
};
$scope.flags = {
bLoginFailed: false,
bIsAuthenticated: false
};
localStorageService.set('credentials', $scope._emptyCredentials);
$scope.unbindCredentials = localStorageService.bind($scope, 'credentials');
alert(JSON.stringify($scope.credentials));
alert(JSON.stringify(localStorageService.get('credentials')));
$scope.credentials = {
'_uid': 1,
'_token': 'aaa',
'_ts': new Date()
};
$timeout(function() {
alert(JSON.stringify($scope.credentials));
alert(JSON.stringify(localStorageService.get('credentials')));
$scope.credentials = $scope._emptyCredentials;
$timeout(function() {
alert(JSON.stringify($scope.credentials));
alert(JSON.stringify(localStorageService.get('credentials')));
});
});
EvanLomas