0

I am using angular ngCookies to read cookies. At present I am using this line to read cookie

$cookies.MYCOOKIE

The problem is that here I have to hard code cookie name, I have different cookie name in test/prod environment, but not able to find a way to read cookie from a variable.

Can someone please help.

coder
  • 4,458
  • 2
  • 17
  • 23

1 Answers1

0

In JavaScript everything is object and to access object property, you should use for example $cookies[variable_name].

monkeyinsight
  • 4,719
  • 1
  • 20
  • 28