Angular - HTTP Client
You wrote this Angular code:
What is the problem with this code regarding loading state?
loading = false;
error = '';
fetchData() {
this.loading = true;
fetch('api/data')
.then(() => this.loading = false)
.catch(() => this.error = 'Error');
}What is the problem with this code regarding loading state?
