Hi everyone, I’ve got the following service, which when running on ionic serve, it only calls the rest service once. When running on the device however, it calls this.http.get each time.
Why would it be different in the browser and the device? Anything I can do to fix this?
export class RestApiService {
wordList: Observable<any>;
constructor(private http: HttpClient) {
}
getDataOnce(): Observable<any> {
try {
console.log('getDataOnce() ');
if (!this.wordList) {
console.debug('REST API: ' + apiUrl);
const response1 = this.http.get(apiUrl);
this.wordList = forkJoin([response1]);
}
return this.wordList;
} catch (e) {
console.log(e);
}
}
}
ps I know i don’t need the forjoin.