title: How to implement a remember me function?
body: <p>I am doing an Angular 4 application with node js backend. I did the login form, and all is good I want to implement the function &quot;remember me&quot;.</p>
  <p>This my login service:</p>
  <pre><code>import { Injectable } from '@angular/core';
  
  @Injectable()
  export class loginService{
    rememberMe: boolean;
    constructor() { }
  
  login(credentials) {
    sessionStorage.setItem('Name', credentials.firstName);
    sessionStorage.setItem('token', credentials.token);
  }
  
  getCostumer() {
    const user = {
      Name:  sessionStorage.getItem('firstName'),
      token: sessionStorage.getItem('token')
  }
  </code></pre>
  <p>This is the component:</p>
  <pre><code>constructor(private signInService: SignInService, private router: Router, 
  public dialog: MatDialog, private authService: AuthService) { }
  
  ngOnInit() { }
  
    login(costumer) {
       this.loginService.login(costumer).subscribe((data) =&gt; {
         this.authService.login(data);
         this.router.navigate(['home']);
         this.dialog.closeAll();
        }, err =&gt; {
         this.message = err._body;
         console.log(this.message);
       });
    }
  }
  </code></pre>