G
G
gimntut2014-07-06 11:00:09
Angular
gimntut, 2014-07-06 11:00:09

How to overcome escaping of & character in Angular.js?

I need to display text containing a non-breaking space:
$scope.myfield = 'A B';
Since & is inserted into the template, & , then instead of a non-breaking space, I see  
I tried several options: codepen.io/anon/pen/yvJlc
But none of them gave the desired result.
At the same time, if you try to enter A B in the demo at angular.ru/api/ngSanitize.$sanitize , then everything is displayed there as I need.
I don't understand what's wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2014-07-06
@gimntut

No trick.
Angular "does not trust" you. Therefore, Sanitize & SCE must be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question