<h1>{{ revision.title }}</h1>
<div ng-bind-html="revision.content"></div>
標題輸出不錯,但內容 - 沒有。它有它的一些html和我得到以下錯誤:Attempting to use an unsafe value in a safe context.
它被描述爲這樣:http://docs.angularjs.org/error/ $ SCE:不安全的,這很好,但後來我怎麼能輸出的內容,將有它的一些HTML,所以我必須將其設置爲{{ revision.content | safe }}
或smthn。什麼是正確的方法?如何通過AngularJS模板輸出html?
編輯:
AngularJS版本:1.2
兩年後的1.4。x,這個看似簡單的修復仍然有效! – xiankai
它解決了我的問題,當我使用** $ compile ** – vanduc1102
和近1.5年後的1.5.x也可以 – azuax