title: Angular - keep values of variables even after navigating away
body: <p>On my first Home Component, on ngOnInit I call a function that subscribes results to a variable and displays those results :</p>
  
  <pre><code>  ngOnInit() {
         this.dataService.getAllData().subscribe(results =&gt;
               this.userData = results.userData;
     }
  </code></pre>
  
  <p>On my HTML I have a function where I need to remove some elements from the array :</p>
  
  <pre><code>      this.userData.splice(this.removedIndex, 1)
  </code></pre>
  
  <p>When navigating away from that screen, and coming back, because of ngOnInit, the userData will have ALL the data from the service again and I need to have only the data remaining after the splice.
  Once logging out and logging back in, then all data can be displayed.
  Is there a way to achieve this?
  Any suggestions?</p>
  
  <p>Thanks.</p>