Friday 17 June 2022

NG13- timer Rxjs operator is equalent to setTimeout in JS, interval for setInterval

 import { timer } from "rxjs";


@Component({ 

})


export class AppComponent implements OnInit{

    progressBar: boolean =  true;  // Show spinner / progress bar initlly


constructor(){

const source = timer(2000); // 2 milli secs

const subscribe = source .subscribe( hide => this.hideProgress() } );

hideProgress(){

this.progressBar = false; // call the hide spinner

}

}

}



 import { interval } from "rxjs";