如何在{{}}中获取空格

时间:2016-11-20 07:04:35

标签: angular

我希望通过块{{}}

在html中获取空格
I tried {{myVariable}}, then I got html with " "
may I know how can I get a html " " in block {{myVariable}}?
Thanks very much.

示例:<div class="o-grid__cell o-grid__cell--width-75">{{task.word.phrase}}</div>

转移到<div class="o-grid__cell o-grid__cell--width-75">someone&nbsp;who&nbsp;tells&nbsp;the&nbsp;actors&nbsp;in&nbsp;a&nbsp;film&nbsp;or&nbsp;play&nbsp;what&nbsp;to&nbsp;do</div>

但我认为必须<div class="o-grid__cell o-grid__cell--width-75">someone who tells the actors in a film or play what to do</div>

在angular1中我搜索https://github.com/angular/angular.js/issues/1505,但不明白如何在Angular2中使用。

2 个答案:

答案 0 :(得分:1)

我认为您希望将my html {{" "}}显示为my html " "。您可以通过" "

升级"来获取内嵌\\的html
I tried {{"\\" \\""}}, then I got html " "

Demo Here

更好的方法是在"(单个qoute)内'(双qoute)。无需逃避。

<summary>I tried {{'" "'}}, then I got html " "</summary>

答案 1 :(得分:0)

您可以使用ngNonBindable,虽然它目前是undocumented

<div ngNonBindable>
{{ }}
</div>