title: Changing stream source
body: <p>In angular I have abstract class which is responsible for query params change:</p>
  
  <pre class="lang-js prettyprint-override"><code>@Injectable()
  export abstract class PageDetailsAbstract&lt;T&gt; implements OnInit {
    object: string;
    id: number;
    details$: Observable&lt;T&gt;;
  
    constructor(
      protected entitiesSelectors: EntitiesSelectors) {
    }
  
    ngOnInit() {
      this.route.params
        .pipe(
          map(resp =&gt; +resp.id),
        )
        .subscribe(resp =&gt; {
          this.id = resp;
          this.adopt();
        });
    }
  
    protected adopt() {
      if (this.id) {
        this.details$ = this.entitiesSelectors.details(this.object, this.id);
      }
    }
  }
  
  </code></pre>
  
  <p>I have also concrete class for detail page:</p>
  
  <pre class="lang-js prettyprint-override"><code>@Component({
    selector: 'app-page-maile-szczegoly',
    templateUrl: './page-maile-szczegoly.component.html',
    styles: [],
    changeDetection: ChangeDetectionStrategy.OnPush
  })
  export class PageMailsDetailComponent extends PageDetailsAbstract&lt;Mail&gt; {
    object = 'mails';
    // ...
  
    ngOnInit() {
      super.ngOnInit();
      this.details$
        .subscribe(data =&gt; {
          // do something with it
          // it's triggered only once
        });
    }
  }
  
  </code></pre>
  
  <p>Problem is that <code>subscribe</code> in <code>ngOnInit</code> is triggered only once. It's because of <code>this.details$ = this.entitiesSelectors.details(this.object, this.id);</code> in parent class. Instance of <code>this.detials$</code> is destroyed and with it <code>subscribe</code> function.</p>
  
  <p>How can have always the same instance of <code>this.details$</code> but always correct one with <code>this.entitiesSelectors.details(this.object, this.id)</code>?</p>