External html file that is loading form server:
<h1>Name {{name}}</h1>
In sample.component.hmtl:
<div class="htmldata" [innerHtml]="htmlData">
</div>
In sample.component.ts:
name: any = 'sample text'
// download file from server
downloadFile() {
this.http.get(this.fileUrl, { responseType: 'text' }).subscribe(res => {
this.htmlData = this.sanitizer.bypassSecurityTrustHtml(res);
console.log(this.htmlData);
});
}