Questions tagged [angular-cookies]

118 questions
5
votes
1 answer

angular-cookies DefinitelyTyped

I'm creating an app using angularjs and typescript. I am using cookies to store same data about user's login and rights etc. I ran into a problem with angular-cookies.d.ts file. $cookieStore work just fine but according to AngularJS docs this…
quicky
  • 97
  • 2
  • 14
5
votes
1 answer

Why AngularJS sends X-XSRF-TOKEN header as JSON string?

Angular sets the X-XSRF-TOKEN header to the value of the XSRF-TOKEN cookie: var xsrfValue = isSameDomain(config.url, $browser.url()) ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName] :…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
4
votes
1 answer

NodeInvocationException: StaticInjectorError[CookieService] - No provider for CookieService

I have an ASP.NET Core 2.0 project with an Angular 5.1.0 ClientApp (VS 2017 v15.4.5). Trying to use ngx-cookie-service. I followed the instructions to import the ngx-cookie-service, but whenever I try DI it into a component or service constructor I…
4
votes
1 answer

How to use $cookies to cache bust Angular Translate static files

The core issue here is that I can't inject $cookies into a config block, and configuring static file loading in Angular Translate seems to only be able to be done in a config block. I have a cookie containing my app version that I'd like to use as…
Daniel Allen
  • 894
  • 1
  • 10
  • 23
4
votes
1 answer

$cookies.putObject not working in angular 1.4

I upgraded from angular 1.2 (original code) more recently to 1.3 (which broke the cookies) to 1.4 as of today ($cookieStore is now deprecated infavor of $cookies) I added a line $cookies.putObject('user', user); but it isn't saved to cookies (i…
chovy
  • 72,281
  • 52
  • 227
  • 295
4
votes
2 answers

How to resolve the cookieStore is not defined error in angular js?

Here when i click on storeAreaInCookie that will result the lat and long of the city those results i have to store in cookies and need to use where ever i want to use in my website.But when am tried to use this code it not storing the cookie and in…
4
votes
1 answer

angularjs $cookieStore SyntaxError: JSON.parse: unexpected character

Have you got any ideas why I get an error SyntaxError: JSON.parse: unexpected character on this code console.log($cookieStore.get('XSRF-TOKEN')); the cookie value is kscJcqrDYSMdZtBleuq8yUrB ? UPDATE NODE CODE var currentSession =…
Whisher
  • 31,320
  • 32
  • 120
  • 201
3
votes
1 answer

Unknown provider: $cookies angularjs

I have tried everything I can think of and I am still receiving this error. app.js: angular.module('myApp', [ 'ngCookies' ]). config(['$cookies', function($cookies) { var cookie = $cookies.getObject(); console.log(cookie); }]) index.html: …
snovosel
  • 91
  • 1
  • 2
  • 10
3
votes
2 answers

Need to read cookies value by it's name angularjs

I've cookie in my application and I need to read it using angularJS ngCookies. When I exported the cookies from browser extension it looks like following json : [ { "domain": "localhost", "hostOnly": true, "httpOnly": false, …
Enigma
  • 749
  • 1
  • 13
  • 35
3
votes
1 answer

angular ngCookies doesn't save cookies after restarting the browser

var app = angular.module('MyApp', ['ngCookies']); app.controller('MyController', function ($scope, $window, $cookies) { $scope.WriteCookie = function () { $cookies.put("Name", $scope.Name); …
Matoy
  • 1,738
  • 3
  • 22
  • 53
3
votes
1 answer

Angular removing cookies on leaving the website

I am looking for a possibility to remove all cookies if the user closes the browser window/tag. Is there any chance to trigger a event or anything else?
3
votes
2 answers

Cookies' update from response delayed in future

I've encountered an odd issue with ngCookies service. Mainly, after receiving a response from my /api/auth/login/ endpoint, with headers: Set-Cookie csrftoken=gxCld8gEga71MuQPQbjDujDBvR4HwPvu; expires=Sun, 28-Dec-2014 15:31:38 GMT;…
Maciej Gol
  • 15,394
  • 4
  • 33
  • 51
3
votes
3 answers

AngularJS - Does $resource requests send cookies automatically?

I am using a $resource in my angularJS app. Does it send automatically my cookies? I am doing requests on the same domain.
poiuytrez
  • 21,330
  • 35
  • 113
  • 172
2
votes
0 answers

SCRIPT1002: Syntax error - IE11, problem with ngx-cookie-service with angular 8

I have a problem with IE11 when I inject 'CookieService' on the 'providers' of 'app.module.ts'. I got this message with freezing page on IE11: SCRIPT1002: Syntax error vendor.js (152116,1) It works with all other navigators, I also tried…
2
votes
1 answer

Using Cookies in angular Universal (for Angular 6 )

I am working on Angular 6 and have installed the Angular universal in it. I am having issues with package ngx-cookie-service as it is not supporting universal (check this issue for more info). Kindly help with any other package support or any…
Alok
  • 21
  • 2