title: localstorage.setitem not working in angular
body: <p>Here is my function below. I can see an object in the console.log with <code>res</code>:</p>
  
  <pre><code>login2(){
      console.log(this.user_form_value);
      console.log(this.password_form_value);
      this._loginService.login(this.user_form_value, this.password_form_value).subscribe(
        res =&gt; console.log(res.user),
        res2 =&gt;localStorage.setItem("getLoggedInUserANG1",JSON.stringify(res2.user))
        )
  
    }
  </code></pre>
  
  <p>But when I try to store the same object in the local storage, it's not being saved. I'm new to angular but there isn't a bug and I don't know why it isn't not being saved.</p>
  
  <p>After saving it I would also want to fetch the same one using <code>getitem</code> in an array variable and have it console.log.  I would like to understand the problem with the basics and where precisely I'm going wrong.</p>
  
  <p>Below is the screenshot of my console.log</p>
  
  <p><a href="https://i.stack.imgur.com/39w1W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/39w1W.png" alt="enter image description here"></a></p>