Hi please help to solve the code. if I embed static HTML file that is stored in my project directory the iframe is not working when i embed live URL in the iframe the iframe is working fine
here my folder structure
src
|-app
| |-components
| |-template
| |-template.component.html
| |-template.component.ts
|-assets
|-templates
|-template1
|-index.html
template.component.html
<iframe [src]="getIframe()" frameborder="0" ></iframe>
template.component.ts
import { Component, OnInit, Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-template',
templateUrl: './template.component.html',
styleUrls: ['./template.component.css']
})
export class TemplateComponent implements OnInit {
constructor(private sanitizer:DomSanitizer) { }
ngOnInit() {
}
getIframe(){
console.log('iframe');
return this.sanitizer.bypassSecurityTrustResourceUrl('../../../templates/template1/index.html');
}
}