Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular http.get() url as raw HTML

I'm creating a site for an assignment, where I want to dynamically load some data. Problem is, that data just comes from a website, no API or anything. Is there some way that I can use http.get in angular to pull the whole site as raw HTML, which I can then parse for info?

Thanks

like image 846
Aaron Ting Avatar asked Sep 08 '26 00:09

Aaron Ting


1 Answers

You can set the responseType to "text" to fetch the response as a string.

this.httpClient.get(url, {responseType: "text"})

See overload method #3:

https://angular.io/api/common/http/HttpClient#get

Note: Cross domain requests for GET are subject to CORS