0

when i call my service i want to set the loader to true,and once the load is done i want to false it,here is where i call my service:

   this.service.getEventLog(e.turID, dtFrom, dtTo).subscribe(s => {
    this.eventlogs = s;
  });

and here is my service:

getEventLog(ip,from,to){

 
return this.http.post(this.url_event_log,{},{params:{id: ip,dtFrom: from,dtTo:to}});
 }

I have boolean field which according to the value set the loader:

  <div *ngIf="loading" class="k-i-loading"></div>

but where in my service i should set to true and false?

1

1 Answer 1

2

you can set like this,

getEventLog(){
  this.loading=true;
  this.service.getEventLog(e.turID, dtFrom, dtTo).subscribe(s => {
    this.eventlogs = s;
  }, (err) => {
    this.loading=false;
  }, () => {
    this.loading=false;
  }));
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.