Timeline for Angular HTML binding
Current License: CC BY-SA 3.0
33 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 12, 2022 at 14:16 | comment | added | Günter Zöchbauer | @Dojo you can't add Angular bindings this way, just plain HTML. You might want dynamic components or add event handlers imperatively. If you need support, please create a new question with full information. | |
Nov 11, 2022 at 17:06 | comment | added | Mohammed | @GünterZöchbauer wen i added like this html is showing but (click) event is not triggering? | |
Oct 14, 2022 at 1:52 | comment | added | GregJF | Voted this up as it is a more complete answer. | |
Sep 21, 2021 at 15:02 | comment | added | RoboticRenaissance | This probably only isn't upvoted as much because it was a year later than the other answer stackoverflow.com/a/34424375/3177709 that says the same thing that this one starts with. That and people have a tendency to not scroll down, and to overlook longer answers. | |
Feb 25, 2020 at 23:05 | comment | added | austin | angular does it automatically, but posts to the console angular.io/guide/security#sanitization-and-security-contexts | |
Apr 8, 2019 at 13:46 | comment | added | Alex P. | @GünterZöchbauer I was just applying your (great) solution to be able to bypass that security filter and define the type of mentioned content. I am not implying at all that this technique is safe - since it's clear that it bypasses a security layer. | |
Apr 8, 2019 at 13:35 | comment | added | Günter Zöchbauer |
@AlexPandrea hard to tell what exactly you were doing, but if you claim the content is safe (for example by using | safeHtml ), then Angular trusts you and you are responsible.
|
|
Apr 8, 2019 at 13:31 | comment | added | Alex P. |
This answer solves the problems generated by HTML consider unsafe. I managed to define text color and add a youtube iframe with it. You cannot achieve this by simply setting the innerHTML like it is descibed in the other answers.
|
|
Feb 7, 2018 at 9:52 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 420 characters in body
|
S Jan 17, 2018 at 11:08 | history | suggested | kvetis | CC BY-SA 3.0 |
Added a security warning to marking user input as safe HTML.
|
Jan 17, 2018 at 10:37 | review | Suggested edits | |||
S Jan 17, 2018 at 11:08 | |||||
Nov 14, 2017 at 7:45 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
deleted 32 characters in body
|
Oct 19, 2017 at 13:30 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 2 characters in body
|
Sep 1, 2017 at 7:04 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 395 characters in body
|
Jul 31, 2017 at 17:00 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 72 characters in body
|
Jul 16, 2017 at 9:32 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 3 characters in body
|
Jul 16, 2017 at 9:31 | comment | added | Günter Zöchbauer |
Use DomSanitizer instead
|
|
Jul 16, 2017 at 5:03 | comment | added | Rolando | [ts] Property 'bypassSecurityTrustHtml' does not exist on type 'Sanitizer'.? | |
Jul 10, 2017 at 7:21 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 13 characters in body
|
Jul 6, 2017 at 10:44 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 2 characters in body
|
May 24, 2017 at 14:40 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 42 characters in body
|
May 23, 2017 at 11:47 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Apr 22, 2017 at 12:31 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
deleted 1 character in body
|
Apr 16, 2017 at 14:26 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
deleted 37 characters in body
|
Apr 13, 2017 at 14:46 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
added 1 character in body
|
Mar 30, 2017 at 11:00 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
edited body
|
Mar 30, 2017 at 9:37 | comment | added | Appulus |
Also import { Pipe } from '@angular/core'
|
|
Mar 20, 2017 at 23:29 | comment | added | crthompson |
be sure to import { BrowserModule, DomSanitizer } from '@angular/platform-browser'
|
|
Mar 20, 2017 at 23:28 | comment | added | crthompson | This should be the answer. Pay attention to the two lines that are commented out. It is actually the second one that handles HTML. | |
Feb 6, 2017 at 9:15 | history | edited | Darren Shewry | CC BY-SA 3.0 |
add link to docs reference in code comment
|
Feb 6, 2017 at 9:03 | comment | added | Darren Shewry | Useful for rendering HTML email bodies, as they tend to have styles embedded. | |
Dec 31, 2016 at 17:17 | history | edited | Günter Zöchbauer | CC BY-SA 3.0 |
deleted 1 character in body
|
Dec 11, 2016 at 17:42 | history | answered | Günter Zöchbauer | CC BY-SA 3.0 |