jeudi 12 octobre 2017

Check the change of api with observable and update data

I have a web service that provide information about the (last) song that is currently playing on a radio.

How can my observable update the data from my http request by itself ?

My provider:

  load() : Observable<{}> {
    return this.http.get(this.URL).map(res => res.json());
  }

My component:

this.radio.load().subscribe(data => {
  console.log(data)
})

What I want, basically is "data" to be updated every time the web service response change ! How can i do that ?

Thank you very much

Aucun commentaire:

Enregistrer un commentaire