Closed lpeppe closed 6 years ago
Well I managed to solve this problem, but it is still kinda weird. It works perfectly if I add a timeout in this way:
this.scraper.getTaReviews(this.navParams.get('name'))
.subscribe(data => {
console.log(data)
if (data != "no data") {
this.placeId = data.placeId;
this.risId = data.risId;
this.hasNext = data.hasNext;
this.rating = data.avgRating;
setTimeout(_ => this.reviews = this.reviews.concat(data.reviews), 1000);
console.log(this.reviews);
}
this.loaded = true;
})
Hope this can help someone
Not sure where could be problem. Please comment here or open new issue if anyone will experience same problem.
Hi everyone, I've just added this module to my application and it works just fine for all the pages, except from the following one:
In this page I show infos and reviews about a specific restaurant (the reviews are displayed inside the ion-list). To retrieve the reviews I used the following code in the .ts file:
Obviously I initiated the reviews variable to be an empty array in the constructor.
This is the function that is called to make the http call:
The uncommented part is the new one, and the commented part is the old working one. My problem is that the first time I open the page and get the data, everything works just fine and the reviews in the ion-list are displayed correctly. When I use cached data, however, the ion-items inside the list are not populated, even though the reviews array contains the correct data (I checked it in the console log). As I said before, it works just fine if I don't use ionic-cache, but I can't really explain why this behaviour affects only this page. Moreover, all the other cached data (except from the reviews) is displayed correctly, it looks like it is a problem just with the ngFor statement.