Pavitar
Pavitar

Reputation: 4374

Angular Cookies don't work after ionic build

I'm tring to store logged in user information in Angular Cookies. Strangely it work's well in browser when I do ionic serve. Also works in phone debug mode using ionic run android -l-c --debug usb debugging mode. But when I do ionic build android user information does not get stored in the $cookiestore.

I have referenced <script src="lib/angular-cookies/angular-cookies.min.js"></script> in my index.html

Upvotes: 0

Views: 388

Answers (1)

Mobiliseme
Mobiliseme

Reputation: 66

Simply replace $cookieStore with localStorage. It plays nice with both Android and iPhone. :)

$cookieStore.set() -> window.localStorage.setItem()
$cookieStore.get() -> window.localStorage.getItem()
$cookieStore.remove() -> window.localStorage.removeItem()

Upvotes: 1

Related Questions