Scenario
We have a markdown file, 1.md
, in the global assets folder and we want to load the content using the HttpClient
.
Approach
Note that we set the responseType: 'text
' option:
async ngOnInit() {
this.md = await this.http.get(`/assets/posts/1.md`,
{ responseType: 'text'}).toPromise();
}