I had an application in angular1 and I was using jquery to load an external page in my HTML element. This is the html of my container element:
<div id="externalContainer" class="text-center">
</div>
I used the following script to load the external page.
$( "#externalContainer" ).load( myExternalPageLink );
Now this doesn't seem to work in angular4, can experts guide me how can I achieve this functionality in angular4?
Following is code from angular component to import external html. http. get('assets/included. html', { responseType: 'text' }).
You can use [innerHtml]
something like
<div [innerHtml]="myTemplate">
</div>
In your component
export public class MyComponent {
private myTemplate: any = "";
constructor(http: Http) {
http.get(myExternalPageLink).map((html:any) => this.myTemplate = html);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With