I am a beginner with Angular(5) and I'm attempting to import a JSON file from the assets folder into a component.
The JSON file contains data for some selections in a form that I want to display in this component.
However, after implementing the following method:
private getJson(url: string, http: HttpClient) {
if (!url.search("[^]*.json")) {
throw InvalidPathException;
} else {
return http.get(url);
}
}
and subscribing to it,
I encounter the following errors in my browser:
ReferenceError: require is not defined
TypeError: stream is undefined
Does anyone know how to resolve this issue?