Angular · Senior · Question 33 of 75
What does Angular do with a value bound to [innerHTML]?
- ✓Correct answer: Sanitizes it: removes scripts, event handler attributes and dangerous URLs
- 2Inserts it as-is, like
dangerouslySetInnerHTML - 3Escapes it so the HTML is shown as text
Explanation
Angular treats all values as untrusted by default and sanitizes them by context (HTML, style, URL, resource URL). It logs a warning in dev mode when it strips content.