One of my classes has a boolean variable called isLoading with a default value of false. It gets set to true when a certain action (HTTP request) occurs and then back to false once the action is completed. I am interested in using RXjs to monitor this variable.
this._dataSource = new HttpDataSource(this.service, this.paginator, this.sort, columns);
//This currently returns false as it happens before the action takes place
this.isListLoading = this._dataSource.isLoading;
I would like to achieve something similar using RXjs
this._dataSource = new MCHTTPDataSource(this.takeThisFormService, this.paginator, this.sort, columns);
const intervalId = setInterval(()=>{
if( !this._dataSource.isLoading ){
this.isListLoading = false;
clearInterval( intervalId );
}
}, 250 );
Any thoughts on this approach?