Closed adebree closed 7 years ago
I use ngx-cookie package and whenever I need to use cookie data I have to use isBrowser property. Here is an example:
import { isPlatformBrowser } from '@angular/common';
import { PLATFORM_ID } from '@angular/core';
public isBrowser: boolean = isPlatformBrowser(this.platformId);
// component constructor
constructor(@Inject(PLATFORM_ID) private platformId, private cookieService: CookieService) {}
if (this.isBrowser) {
let name = cookieService.get('name');
}
You can use this library, https://www.npmjs.com/package/universal-cookie
Thanks for your example repo! Really helpful. I do encounter a challenge with reading cookie data. How to get the cookie value from the request? renderModuleFactory or Express itself doesn't seem to inject it.