Questions tagged [ngx-cookie-service]

ngx-cookie-service is an Angular library that helps to set, get and delete cookies in browser

33 questions
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
6 answers

How to set secure flag in my cookie using ngx-cookie-service for Angular?

I want to set the secure flag in my cookie when I create it. I think I have the solution but I want to be sure in order to continue. I use the ngx-cookie-service to set my cookie. Here is my code: const now = new Date(); now.setHours(now.getHours()…
TheodoreTsg
  • 510
  • 3
  • 9
  • 23
7
votes
2 answers

Angular4x : ngx-cookie-service with expire parameter

I am using ngx-cookie-service component but as soon as i close the browser the cookies disappears, maybe i have to set the expire parameter but i can't get it , below what the the documentation says: set( name: string, value: string, expires?:…
Gelso77
  • 1,763
  • 6
  • 30
  • 47
4
votes
2 answers

Cannot find module 'ngx-cookie-service'

Iam using Angular 12, I installed cookie by using: npm install --save ngx-cookie-service in app.module.ts when I import 'CookieService' import { CookieService } from 'ngx-cookie-service'; I got this error message: Cannot find module…
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…
3
votes
2 answers

how we can access cookies in angular 6 without ngx- cookie service

login() : any { for(let data of this.loginsdata) if(this.username == data.usr && this.password == data.pw){ // this.toastr.success('logged in'); console.log(this.username); console.log(this.password); …
Akhil Raghav
  • 313
  • 1
  • 4
  • 16
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

NGX Cookie service returns nothing

I'm using NGX Cookie Service in my AuthGuard.ts to check if a user is logged in using a cookie. The problem is when I try to get the raw value of the cookie user the function get it always returns me a blank string. However I can still create a…
Wilson Silva
  • 1,324
  • 1
  • 14
  • 25
2
votes
2 answers

Angular 8 save array in cookie

I am using ngx-cookie-service package { "user": [ { "id": 109, "name": "name1", "job" : "job name" } ], "token":"xxxx" } this.cookieService.set( 'user_id', result.user.id ); …
ShibinRagh
  • 6,530
  • 4
  • 35
  • 57
2
votes
2 answers

How to set the cookie expire date with `ngx-cookie-service`

I am using ngx-cookie-service for my angular5 app. any one help me to show the way to set the expire date? I try like this: setCookies($event){ this.cookieService.set( 'retailAppCookies', "true", 30 ); this.cookieService.set(…
user2024080
  • 1
  • 14
  • 56
  • 96
1
vote
2 answers

Unit Test Error when having CookieService as argument in constructor of tested component

I would like to test a function. To call that function in unit test I need to create an instance of the component class. The component class contains different services as arguments in the constructor including the service CookieService. The service…
Hiraja
  • 75
  • 1
  • 9
1
vote
1 answer

How to set expire time of Cookie using `ngx-cookie-service`

I am using ngx-cookie-service for my angular app. In the official docs it says I can add a third parameter for the expiration time like - this.cookieService.set('CookieName', 'Cookie Value', 5); The third parameter is for expire time in days. Is…
RAHUL KUNDU
  • 745
  • 2
  • 12
  • 33
1
vote
1 answer

ERROR in The target entry-point "ngx-cookie-service" has missing dependencies: in Angular 10.1.2

I am making a change from local storage to ngx-cookie-service but when running the platform I get the error: ERROR in The target entry-point "ngx-cookie-service" has missing dependencies: @ angular / core @ angular / common My app.module.ts import…
1
vote
1 answer

ngx-cookie-service is not working with Angular 11 Universal SSR

Currently I am switching a fully functional Client Side Angular Application into Angular Universal Server side rendering. ngx-cookie-service is not working with SSR. Is it possible to make it work somehow. I have gone through several npm packages…
1
vote
1 answer

ngx-cookie gets deleted when link is opened in new tab in Angular Application

I have used a PC to serve the website via LAN connection and use the IPv4 address instead of localhost for hosting the website on LAN. I'm using the npm package http-server for serving the dist compiled angular application. I'm using…
Srinath Kamath
  • 542
  • 1
  • 6
  • 17
1
2 3