Quick Answer
Angular sanitizes values bound to innerHTML, style, URL attributes, and resource URLs by default. The DomSanitizer strips dangerous HTML before inserting into DOM (prevents XSS). Property binding [innerHTML] is automatically sanitized. To bypass sanitization (with care): DomSanitizer.bypassSecurityTrust*(). Angular's template syntax safely escapes interpolated values - they're text nodes, not HTML.
Answer
Angular uses DomSanitizer to remove harmful HTML, URLs, and scripts, protecting against XSS attacks.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.