Questions tagged [angular-cookies]
118 questions
238
votes
9 answers
How to access cookies in AngularJS?
What's the AngularJS way to access cookies? I've seen references to both a service and a module for cookies, but no examples.
Is there, or is there not an AngularJS canonical approach?

Ellis Whitehead
- 6,338
- 4
- 18
- 14
81
votes
8 answers
How to set expiration date for cookie in AngularJS
We want to store User's Authorization information in cookie which should not be lost upon refresh (F5) of browser.
We want to store authorization info in "permanent-cookie" in case user has opted for "Remember Me" check box at the time of log-on.

Anand
- 4,523
- 10
- 47
- 72
42
votes
4 answers
What is the equivalent to AngularJS's ngcookie in Angular 6?
How can you create cookies in Angular 6? For AngularJS there was ngcookie. What is the equivalent way to create cookies in Angular 6?

Akshay
- 621
- 1
- 5
- 15
28
votes
6 answers
24
votes
2 answers
How to remove all cookies in Angularjs?
I can set a cookie like this:
$cookieStore.put('myCookie','I am a cookie');
And I can remove it with
$cookieStore.remove('myCookie');
But how can I remove all cookies?

s.alem
- 12,579
- 9
- 44
- 72
21
votes
3 answers
How to clear cookies in angular.js
Currently am using angulajs app.
I want to store some values in cookie. So i used angular-cookies-min script for add some values to cookies
I have used this below code for save values to cookie.
$cookieStore.put("userInfo", userInfo);//userInfo is…
user2998788
12
votes
2 answers
Angular cookies appearing with encoded characters
Given some data:
$scope.devices = [
{ name: 'iPhone 4', os: 'iOS'},
{ name: 'Nexus 7', os: 'Android'},
];
And a function to set a cookie:
$scope.saveDeviceChoice = function() {
$cookieStore.put('savedDevice', $scope.deviceChoice.name);
}
I…

Wolfr
- 5,055
- 4
- 25
- 31
9
votes
1 answer
Saving cookie using angular 4
I have a ldap based authentication in place where if the user credentials are matched , a bearer token and an userId is received as a response in JSON format. Now I need to save these values in cookie. I am using angular 4. I could not find any…

user9040429
- 690
- 1
- 8
- 29
7
votes
2 answers
Angular 9 - ngx-cookie-service troubles with path
I'm using ngx-cookie-service package to store some data relevant to my application.
I need to save this cookie on the base path '/', so each time I know exactly how to retrieve it.
This cookie of mine needs to be updated and when such happens, the…

dc_Bita98
- 851
- 2
- 17
- 35
7
votes
1 answer
$cookieStore expires not being set
I am setting expiration date of a the cookie in the following manner:
var dt = new Date();
dt.setMinutes(dt.getMinutes() + 30);
$cookieStore.put("loggedin", true, { expires: dt })
The cookie is being created but the…

americanslon
- 4,048
- 4
- 32
- 57
6
votes
1 answer
Unable to read certain cookies
i am trying to read cookies from browser in order to setup an authguard. I am trying to check if cookies are setup then user is logged in otherwise not. For this purpose i am using ngx-cookie-service. Here is code for getting value from…

Shoaib Iqbal
- 2,420
- 4
- 26
- 51
6
votes
3 answers
Create cookie with AngularJS
I tried to use the code below to set cookies:
angular.module('myApp').controller('myController', ['$scope', '$http','$cookies', function ($scope, $http, $cookies) {
$scope.setMyCookie = function () {
$cookies.put('Mykey', 'MyValue'); …

TheBoubou
- 19,487
- 54
- 148
- 236
5
votes
4 answers
How to protect web application from cookie stealing attack?
My web application's authentication mechanism currently is quite simple.
When a user logs in, the website sends back a session cookie which is stored (using localStorage) on the user's browser.
However, this cookie can too easily be stolen and used…

CodyBugstein
- 21,984
- 61
- 207
- 363
5
votes
3 answers
$cookies with angularjs 1.4 expiration date
How do i set the cookie with expiration date with angularjs 1.4. The documentation says to use
expires - {string|Date} - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object indicating the exact date/time this cookie will expire.
But…

Alaksandar Jesus Gene
- 6,523
- 12
- 52
- 83
5
votes
3 answers
AngularJS: $cookies.remove is not a function
I am getting the error - "$cookies.remove is not a function" - when trying to clear the cookies in my angular application. As far as I can see I am following what the angular docs says, and also what has been said on this forum to remove…

user3407039
- 1,285
- 5
- 25
- 51