2016-11-20 189 views
-3

我想通过块获取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>

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

+0

问题是有点困惑..你期待什么发生? –

+0

我添加示例 –

回答

0

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

<div ngNonBindable> 
{{ }} 
</div> 
+0

不适用于2.2.1 –

1

我认为你想显示my html {{" "}}my html " "。您可以通过" " escapping "通过\\

I tried {{"\\" \\""}}, then I got html " " 

Demo Here

更更好的办法让HTML内插值将"'(单qoute)(双qoute)。无需转义。

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