Problem:
In an Angular 6 project, a simple component that gets json data from a local file generates error: ExpressionChangedAfterItHasBeenCheckedError
Solution:
Do not use the following method to import local json data into the component:
const data = require('./data.json');
Use other standard approaches e.g.
this.http.get(this.dataUrl).subscribe((data: any) => {
// Do something with json data!
});
No comments:
Post a Comment