In jQuery we could perform an ajax request and to an external page that returns HTML, and simply assign the .html() of a div on our current page to the result of the call, and the html from the external page would be loaded.
Another jQuery option was to use .load(ur;) on a div, and the div would have the html of the url provided loaded into it.
How do we perform a similar task in Angular 2? I am trying to do the below call, where url is url of an HTML page
this._http.get(url)
.map(res => res.text())
.subscribe(
data => {
this.temp = this.sanitizer.bypassSecurityTrustHtml(``);
this.temp = data;
}
Then, I perform binding as follows:
<div [innerHTML]="temp">
The call works, but, and I see content from the url I performed a get on inside of my div on the local page, however, the CSS is off and some of the JS scripts don't work. Any thoughts. Note, the url I'm calling out is a page in one of my apps, so I trust the HTML that will be returned.
Please let me know if you have any insight or suggestions.
Thanks!