角$的CookieStore服务 - 与子域共享的cookie [英] Angular $cookieStore service - share cookie with sub domains
问题描述
我想知道是否有采用了棱角分明$的CookieStore服务,从几个不同的子域访问一个cookie的设置,比方说,一个办法: api.yoursite.com
www.yoursite.com
键,仅仅指刚 yoursite.com
I was wondering if there is a way to access an cookie set using angular $cookieStore service, from several different subdomains, let's say: api.yoursite.com
www.yoursite.com
and jsut yoursite.com
借助文档没有提到这个问题的。
The documentation doesn't mention this issue at all.
是否有解决方案,还是必须使用较低级别的JavaScript API的cookie?
Is there a solution, or do I have to use the lower level JavaScript cookies API?
推荐答案
在角默认的CookieStore
服务不支持这一点。
The default cookieStore
service in angular doesn't support this.
此功能之前已经被要求.js文件/问题/ 950
和其他人问类似的问题:如何设置angularJS $饼干域
This feature has been requested before: https://github.com/angular/angular.js/issues/950 and others have asked similar questions: how to set domain for angularJS $cookies
看来你的选择是写自己的cookeistore或使用别的东西。
It seems your options are to write your own cookeistore or use something else.
我会建议您尝试: https://github.com/ivpusic/angular-cookie
I would recommend trying: https://github.com/ivpusic/angular-cookie
这篇关于角$的CookieStore服务 - 与子域共享的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!