title: Angular 8 - Clear cookies using CookieService
body: <p>I'm trying to clear all the info my app is saving in the browser, whether it's in sessionStorage, localStorage or cookies.</p>
  
  <p>I've added this small method to do so, and it get called in the <code>ngOnInit</code> of one of my components:</p>
  
  <pre><code>export class SomeComponent implements OnInit {
  
      constructor(private cookieService: CookieService) {}
  
      ngOnInit(): void {
          this.clearAppData();
      }
  
      private clearAppData(): void {
          sessionStorage.clear();
          localStorage.clear();
          this.cookieService.deleteAll();
  }
  </code></pre>
  
  <p><code>sessionStorage</code> and <code>localStorage</code> seems to be cleared, yet I can see that the cookies are not.
  I need to manually clear the cookies through the browser.</p>
  
  <p>Moreover, sometimes I see that the cookie is saved under the root path, and sometimes I see it under the relative root path. I'm not sure what is the cause of this, and as sometimes it sends the wrong cookie, I would like to clear everything before getting a new one.</p>
  
  <p><a href="https://i.stack.imgur.com/UAfsv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UAfsv.png" alt="enter image description here"></a></p>
  
  <p>Any suggestions what am I doing wrong?
  Thanks!</p>