@JobsMonika wrote:
I have file of tips that I want to print. Every pressing on the button the next tip will print from the json file. So I wrote a function, but right to now the reading from the file doesn’t stop (attaching image of the log).
Any idea to get this information?
Many thanks!
The function .ts:tips: any;
getDataJSON() { return new Promise(resolve => { this.http.get('/assets/advices.json') .subscribe((data) => { resolve(data); console.log(data); this.getDataJSON().then(data => { this.tips = data; }, err => { console.log(err); }); }); }) }html:
<button ion-button block (click)="getDataJSON()">Fetch External Data</button>
Posts: 4
Participants: 2