title: angular - can't run rxjs interval with angular universal
body: <p>I made a carousel effect through the RXJS's interval timing to change parameter. </p>
  
  <p>I found that it works in development mode(ng serve), but it does not work properly in the <code>universal</code> mode, It's can't enter the page.</p>
  
  <p>For example:</p>
  
  <pre><code>n: number = 0;
  max: number = 5;
  
  constructor(){}
  
  ngOnInit() {
    this.carousel();
  }
  
  carousel() {
    this.subscription = interval(2000).subscribe(() =&gt; {
        //In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
        console.log(`show the photo: ${this.n}`);
        if (this.n&gt;this.max){
          this.n = 0;
        }else{
         this.n = this.n+1;
        }
    }
  }
  
  ngOnDestroy() {
    this.subscription.unsubscribe();
  }
  </code></pre>
  
  <p>I found in <code>universal</code> model, assume that the carousel effect is on the page <code>B</code>, you can successfully enter page B through the link on page <code>A</code>, but opening page B directly will fail.</p>
  
  <p>I tried to start the carousel in <code>ngAfterContentInit()</code> and it doesn't work.</p>