title: Angular 8 clearing localStorage on logout
body: <p>I am using <code>localStorage</code> for auth token. 
  to save it I am using <code>localStorage.setItem('token','value')</code> and to remove it I am using <code>localStorage.clear()</code> and both working fine. But when I logged in with another user the service constructor is till sending the previous token which is actually deleted from <code>localStorage()</code>. 
  service constructor is below</p>
  
  <pre><code>  token: string;
    constructor(private http: HttpClient) {
      const user = JSON.parse(localStorage.getItem('eq_user'));
      if ( user ) {
        this.token = user.access_token;
      }
    }
  </code></pre>
  
  <p>Login:</p>
  
  <pre><code>login() {
    this.auth.login(data).subscribe((response: UserToken) =&gt; {
      localStorage.setItem('eq_user', JSON.stringify(response));
      this.router.navigate([this.returnUrl]);
    },
    error =&gt; {
      this.error = true;
      this.errorMsg = error.message;
    }
  }
  </code></pre>
  
  <p>Logout</p>
  
  <pre><code>onLogout() {
      localStorage.removeItem('eq_user');
      localStorage.clear();
      this.authService.logout().subscribe( s =&gt; {
          this.route.navigate(['login']);
     });
    }
  </code></pre>
  
  <p>following is link identical to my issue.</p>
  
  <p><a href="https://stackblitz.com/edit/angular-wabtj6?file=src%2Fapp%2Fapp.component.html" rel="nofollow noreferrer">https://stackblitz.com/</a></p>
  
  <p>First click on <code>setValue</code> and then click on A from Component and A from Service, on first time it will take the correct value. But when you click again on setValue and then click on the other two buttons the Component button return fresh value but the service is not returning the fresh values.</p>