2016-11-20 188 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>