title: Logout button doesn't clear Local Storage
body: <p>I have created a login which stores a token in the local storage. The logout button I created should delete this token from the local storage and set the user to null, but it doesn't and the user stays logged in.</p>
  
  <p>This is the method in the navbar.component.ts</p>
  
  <pre><code> onLogoutClick(){
      this.authService.logout();
      this.flashMessage.show('You are logged out', {
        cssClass:'alert-success',
        timeout: 3000
      });
  </code></pre>
  
  <p>This is the logout link in the navbar.component.html: </p>
  
  <pre><code>&lt;li&gt;&lt;a class="nav-link" (click)="onLogOutClick()" href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>The auth.service.ts: </p>
  
  <pre><code> import { Injectable } from '@angular/core';
  import { Http, Headers } from '@angular/http';
  import { map } from 'rxjs/operators';
  import { tokenNotExpired } from 'angular2-jwt';
  
  
  @Injectable({
    providedIn: 'root'
  })
  export class AuthService {
  authToken: any;
  user: any;
  localUrl : string = 'http://localhost:3000/api/users';
  
    constructor(private http: Http) { }
  
    registerUser(user){
      let headers = new Headers();
      headers.append('Content-Type', 'application/json');
      return this.http.post('http://localhost:3000/users/register', user, {headers: headers})
      .pipe(map(res =&gt; res.json()));
    }
    authenticateUser(user){
      let headers = new Headers();
      headers.append('Content-Type', 'application/json');
      return this.http.post('http://localhost:3000/users/authenticate', user, {headers: headers})
      .pipe(map(res =&gt; res.json()));
    }
  
    storeUserData(token, user){
      localStorage.setItem('token', token);
      localStorage.setItem('user', JSON.stringify(user));
      this.authToken = token;
      this.user = user;
    } 
  
    loggedIn(){
      return tokenNotExpired();
    }
    logout(){
      this.authToken = null;
      this.user = null;
      localStorage.clear();
    }
  
    getProfile(){
      let headers = new Headers();
      this.loadToken();
      headers.append('Authorization', this.authToken);
      headers.append('Content-Type', 'application/json');
      return this.http.get('http://localhost:3000/users/profile', {headers: headers})
      .pipe(map(res =&gt; res.json()));
    }
  
    loadToken(){
      const token = localStorage.getItem('token');
      this.authToken = token;
    }
  }
  
  </code></pre>