-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not Deleting Cookies #5
Comments
I ran into a similar problem but found that the reason was that when deleting the cookie you also need to take into consideration the domain and path cookie is set to (you can see those using i.e. the developer tools for Chrome). In my case the application was running on this.cookies.remove(name, { domain: '.domain.com' }); |
The solution proposed by @mbark does solve the problem. Passing the same options used to put the cookies will delete. However, this only works to I think this can be solved easly by just adding an optional option param to the |
Merged the PR. Thanks 👍 |
I'm submitting a ... (check one with "x")
Current behavior
When calling
cookies.removeAll
orcookies.remove
functions the cookies are not deleted and are still persisted in browserExpected/desired behavior
I expect the cookies to be deleted
Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar.
This is in TS, so I cannot reproduce in plnkr. But I can share some code. I have 2 modules, an app.modules, which is my main module, and a core.module which holds all core app components and services. I included the
CookieModule.forRoot()
to the app module as directed in the usage as well as in my core module, where i have triedCookieModule.forChild()
andforRoot()
with no avail.App Module
Core Module
Then within my service in Core module I inject the service using my constructor and use the cookies service as follows:
When i
console.log
the output i see the token after its supposed to be deleted.In addition, Im using webpack 2 and am importing ngx-cookie in my vendor.browser.ts like so:
import 'ngx-cookie';
What is the expected behavior?
I expect the cookie auth.token to be removed.
Please tell us about your environment:
**ngx-cookie version:**0.0.0-development - as seen in package.json
Angular version: 4.1.0-beta.1
Browser: [ Chrome: 58.0.3029.81 (64-bit)]
The text was updated successfully, but these errors were encountered: