Carlo Zottmann
Carlo Zottmann

Reputation: 615

Is there a way to disable Angular's double curly brace notation for selected DOM elements?

On our website we display user-generated content (blog posts etc.). It's rendered by a Symfony app. The frontend is currently being rewritten in the form of an Angular app. Now we noticed that when a user's blog post contains double curly brace notation, Angular will process it, which is undesired.

Is there a way in Angular to disable the double curly brace parsing for certain DOM elements?

Upvotes: 4

Views: 1035

Answers (2)

James
James

Reputation: 12806

Yes, use the ng-non-bindable directive. in the element that wraps your dynamic user editable content.

<div ng-non-bindable>{{some text}}</div>

Upvotes: 11

shaunhusain
shaunhusain

Reputation: 19748

I'm not sure about a direct answer for ignoring interpolation on certain elements but you can change the symbol used if it's in conflict with other data you have:

http://docs.angularjs.org/api/ng.$interpolateProvider#endsymbol

Upvotes: 3

Related Questions