title: how to save JSON data after a http Post request in Angular
body: <p>Hello guys here is my  <code>http post</code> code</p>
  
  <pre><code>createPost(input:HTMLInputElement){
      // input.value='';
      let post={content:input.value};
      let head = new Headers({ 'Content-Type': 'application/json' });
      let requestOptions = new RequestOptions({headers: head});
      let body = JSON.stringify(post);
  
      this.http.post(this.url,body,requestOptions)
        .subscribe(response =&gt; {
          post['id']=response.json().id;
          this.posts.splice(0,0,post);
        });
  </code></pre>
  
  <p>after a successfull <code>http post</code> request my server responds with a token for authentication to make that request, the token would be in <em>JSON</em> format. Now is there any way where I can get that token in real time and store it in local storage directly after a <code>http post</code> call</p>
  
  <p>I can understand the concept of <code>localStorage.getItem()</code> and all but don't know where to implement them exactly to the context of my code 
  this question might be so dumb to you but I'm just beginner in Angular</p>