This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(ngCookies): Additional parameters for $cookies service (domain, expires, secure) #6335
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR allows setting additional parameters on cookies created by $cookieStore. The changes are only on $browser to avoid major changes. It seems to me the cookie logic could be somehow moved to $cookies, but I will leave that to someone else. The `expires` parameter can be specified as integer seconds or as a `Date` object. The parameters are set as follows: ``` angular.extend($browser.cookieOptions, { path: '/', domain: '.example.com', expires: 3600 }); ``` Closes #590, and is an alternative PR to #2459
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Sweet need this feature, any info about what version this will be available? |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
+1 |
return [ | ||
escape(name) + '=' + escape(value), | ||
opt.expires ? '; expires=' + opt.expires.toUTCString() : '', | ||
opt.path ? '; path=' + opt.path : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave here the cookiePath
as a fallback, so
- not specifying the path has the same effect like before patch
- this is IMHO good default value; it's easier to specify '' as a option then to pass the basePath every time we set cookie.
'; path=' + typeof opt.path === 'string' ? opt.path : cookiePath,
This PR is no longer valid given 92c366d |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows setting additional parameters on cookies created by $cookieStore. The changes are only on $browser to avoid major changes.
It seems to me the cookie logic could be somehow moved to $cookies, but I will leave that to someone else.
The
expires
parameter can be specified as integer seconds or as aDate
object.The parameters are set as follows:
Closes #590, and is an alternative PR to #2459