0

how to print the value of a property as html in angular.

I have a property that have a iframe of google maps and I want to show the iframe of google in angular html.

room.mapgoogle = <iframe .....

Must I use a pipe?

  • 1
    Note that binding `innerHTML` directly is a terrible idea and you should at least use the [`DomSanitizer`](https://angular.io/api/platform-browser/DomSanitizer). The [second answer](https://stackoverflow.com/a/41089093/14956277) in the dupe target I linked shows an example. – D M Mar 02 '21 at 19:28
  • yes I used domSanitizer but using domsanitizer fix the security problem? – bugfaztaz Mar 02 '21 at 19:41
  • It can, yes. [The recommended way](https://stackoverflow.com/a/38037914/14956277) is to have only the URL in your property and bind it to an `iframe` that already exists in your component template or that you declare and insert yourself. – D M Mar 02 '21 at 19:51

0 Answers0