We don’t actually need $sanitize
to sanitize strings.
ng-bind
automatically implements sanitizing in the background with textContent
. However, sometimes we need to pass string in as template in controllers and services, or pass it in as the exact content of “name
” attribute of an input, then $sanitize
doesn’t work anymore.