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";


No comments:

Post a Comment

Data scientist in 2025 - guide YT

  Reference from YouTube Channel:  Sahil & Sarra ► Everything in one place: Datacamp Associate Data Scientist with Python Career Track: ...