angular.forEach($cookies, function (cookie, key) {
if (key.indexOf('NAV-') > -1) {
$window.sessionStorage.setItem(key, cookie);
delete $cookies[key];
}
});
上記のコードは機能しますが、Chrome インスペクション ユーティリティの [リソース] タブには、Cookie が削除されていないことが引き続き表示されます。Cookie を印刷して、Cookie が実際に削除されていることを確認しました。
console.log('START printing cookies AFTER deleting them');
angular.forEach($cookies, function (cookie, key) {
console.log(key + ': ' + $cookies[key] + '\n');
});
console.log('DONE printing cookies AFTER deleting them');
お役に立てれば