title: How to use JSON variable in setInterval delay in Angular 11
body: <p>I am working on Angular 11 project. I want to loop the code after 'X' duration mentioned in JSON.data. Here is my following code snippet.</p>
  <p><strong>data.json</strong></p>
  <pre><code>pageOrder: {
     pageDetails:[
     {
       &quot;duration&quot;: 5
     },
     {
       &quot;duration&quot;: 7
     }]
  }
  </code></pre>
  <p><strong>app.component.ts</strong></p>
  <pre><code>id: any = 0;
  reloadFunction();
  ....
  ....
  ....
  reloadFunction(): void {
      // most of your code
      console.log('wassup'); //**this should run after &quot;duration&quot;, unfortunately its not working**
  
      setTimeout(this.reloadFunction, pageOrder[this.id].duration * 1000);
  
      this.id += 1;
      if (this.id === pageOrder.length) {
        console.log('wassup1', this.id);
        this.id = 0;
      }
    }
  </code></pre>
  <p>Unfortunately, the code is looping only once, why???</p>