1

我将 localStorageServiceProvider 存储类型设置为“localStorage”。我很好,它总是将 localStorage 用于任何存储。

localStorageServiceProvider
          .setPrefix('VCMS')
          .setStorageType('localStorage')
          .setNotify(true, true)

在 mu 控制器中,我这样使用

$scope.submit = function () {
        dataservice.authenticateUser($scope.userName, $scope.password)
            .then(
                    function (data) {
                        debugger;
                        console.log('Success');
                        localStorageService.remove(TOKENDATAKEY);
                        localStorageService.set(TOKENDATAKEY, data.access_token);
                        localStorageService.set(TOKENDATAKEY, data.access_token);
                    }
                );
    };

我的问题是如何将默认存储类型从 localStorage 更改为 sessionStorage。我需要在本地存储和会话存储中存储一个值。我们应该怎么做。先感谢您。

4

1 回答 1

0

谢谢苏巴什·塞尔瓦拉杰。我们可以在这个 http://github.com/gsklee/ngStorage上使用

于 2015-12-02T20:53:14.637 回答