$cookieStore:如何实现,如何销毁?

$cookieStore: how to implement it, and how to destroy it?

现在我正在使用 ngCookies,我需要知道如何实现它以及如何在用户注销时销毁该数据

我设置这个函数来检索数据

$scope.localStorageInfo = function() {
    $scope.userDisplayInfoName = $cookieStore.get('username');
    $scope.userDisplayInfoEmail = $cookieStore.get('email');
  };
$scope.localStorageInfo();

$scope.signIn = function () {
        $scope.userDisplayInfoName = $rootScope.name.displayName;
        $scope.userDisplayInfoEmail = $rootScope.name.email;
        $cookieStore.put('username', $rootScope.name.displayName);
        $cookieStore.put('email', $rootScope.name.email);
};

所以,这是正确的方法吗?以及如何在用户注销时销毁该数据以及我如何知道该数据是否已从 localStorage 中删除?

Set:
$cookieStore.put('ItsMe', 12345);

Retrieve:
$cookieStore.get('ItsMe');

Remove:
$cookieStore.remove('ItsMe');

是的,这是正确的方法。您可以使用 remove 方法销毁您的 cookie:

$cookieStore.remove('username');