Hi I’m trying to wrap on how to update a table angular 2.
Here is what I have: Backend: express / MongoDB. Updates are feed into the DB via an external app Data: 90% da
Observables are event-based so they can be used to receive events from server leveraging web sockets. Have a look at this article (section "Event-based support"):
In fact it's new objects but you can leverage the scan
operators to aggregate the content of several events.
var obs = (...)
obs.startWith([])
.scan((acc,value) => acc.concat(value))
.subscribe((data) => {
console.log(data);
});
See this question for more details:
If you want to pull with a time interval, you can leverage the interval
method:
Observable.interval(3000).flatMap(() => {
return this.http.get('/some-request').map(res => res.json());
}).subscribe((data) => {
console.log(data);
});