سؤال

In my app the users can provide a description for their profiles. Problem is that I don't restrict them from giving angular-like expressions like {{ some expression }}. That way my app is XSS vulnerable. Is it possible to make angular leave the contents of an element as is and not evaluate them even if they have angular expressions?

هل كانت مفيدة؟

المحلول

Not sure if it fits your use case, but there is the ngNonBindable directive:

<div ng-non-bindable>This is a {{profile}}</div>

Will simply show:

This is a {{profile}}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top