From 1b35ca176c4da5991867be5e13f74e020379a7aa Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 21 May 2016 12:23:58 +0300 Subject: [PATCH] Added setStorageCookie --- ngStorage.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ngStorage.js b/ngStorage.js index bf9d34a..70e657e 100644 --- a/ngStorage.js +++ b/ngStorage.js @@ -107,6 +107,16 @@ deserializer = d; }; + this.setStorageCookie = function(exp, path) { + var date = new Date(); + var exp = exp || 365; + var path = path || "/"; + date.setTime(+date + (exp * 86400000)); + document.cookie = "expires=" + date.toGMTString() + "; path=" + + path; + return this; + }; + this.supported = function() { return !!providerWebStorage; };