I have a project and i have to use same component twice in one page but component didn't give permission for this so i want to use it with iframe but i couldn't find how can i set iframe src as string html. I can bind html with a div but i couldn't do this with iframe
This is my translater pipe:
@Pipe({ name: 'safe' })
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(url) {
return this.sanitizer.bypassSecurityTrustHtml(url);
}
}
My html page:
<div [innerHTML] = "template | safe"></div>
i can get with this method but i need a seperated page so
<iframe [src] = "template | safe"></iframe>
i need to do it with iframe.
and this is my Typescript file :
template: SafeHtml;
constructor() {
this.template = '<button class="btn btn-lg btn-success">...</button>';
}