Angular router is catching url from iframe

Viewed 816

I have an iframe that should load external content. The problem is that my Angular application is hosted on

http//mydomain

And the iframe loads src url is

http://mydomain/external

I really need the domains to be the same for CORS reason because I want to manipulate the iframe content.

The problem is taht Angular router catches the route and throws an error

Cannot match any routes. URL Segment: 'external'

I've sanitized the url of the iframe in my component with the following method

bypassSecurityTrustResourceUrl()

I don't know how to bypass angular router or to load my content.

Any help would be appreciated.

thanks

1 Answers

I hope it help.

Html

<iframe class="iframeSomeStyle" [src]="safeUrl"></iframe>

Ts

safeUrlCheck(url) {
    this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
Related