title: How to destroy a service instance in angular?
body: <p>In my Angular app I need to share a service instance between one component to another component, and after that destroy the service instance, how to do that?</p>
  
  <pre><code>       AppModule
       /          \
   Module1        Module2
     /               \
  ProductComponent    LogComponent              ? LogService
  </code></pre>
  
  <p>The <code>ProductComponent</code>:</p>
  
  <pre><code>   constructor(private _logService: LogService) { }
  
     viewLog() {
        this._logService.productId = this.product.id;
        this._router.navigate(['/app/administration/logs']);
     }
  </code></pre>
  
  <p>The LogComponent :</p>
  
  <pre><code>  constructor(private _logService: LogService, private _adminService: AdminService) {
  
         this._adminService.getLogs(_logService.productId).subscribe(.....);
    }
  </code></pre>
  
  <p>I put the <code>LogService</code> on <code>AppModule</code> to create a Singleton. It works ok, but i dont want to keep this <code>LogService</code> instance after the user leaves the <code>LogComponent</code>. I need to destroy it. How can I do that?</p>