I'm developing an application with IONIC 2 where I use a webservice REST, of an application that is running online. In the page opening, I make the request and display information correctly on the screen, however, when an item is inserted or changed on the server, the view does not update, but when I exit and return to the page.
Some snippets of code being used:
Vision:
<span *ngFor="#item of depoimentos">{{item.nome)}}</span>
Controller class that initializes testimonials:
ngOnInit() {
this.service.findAll().subscribe(
data => {
this.depoimentos = data;
console.log(this.depoimentos);
if (this.depoimentos.length > 0) {
this.depoimentos[0].visivel = true;
}
}
)}
Excerpt from service requesting:
findAll() {
return this.http.get(depoimentosURL)
.map(res => res.json())
.catch(this.handleError);
}
Remembering: I'm using Ionic 2, which works with angle v2.0.0-beta.15