我的數據庫存儲產品信息,其中很多都是按列表組織的。我將數據加載到Angular中作爲$scope.post
。AngularJS - 渲染包含在字符串中的HTML標記
例如,
$scope.post.size_description = '<li> Fits true to size. Take your normal size\r</li>
<li> Slim-cut, mid-rise style</li>
<li> Long in length, alter to fit</li>
<li> Model wears an IT 48\r</li>
<li> Model measures: waist size 32, height 6\'1"/ 185cm\r</li>'.
當我嘗試這個數據加載到我的角的應用程序,它就會呈現爲文本(即<li>
不被解析)。我知道這可能是出於安全原因,但有沒有辦法解決它?
可能重複的[插入HTML到視圖中使用AngularJS](http://stackoverflow.com/questions/9381926/insert-html-into-view-using-angularjs) –
看看:http://docs.angularjs.org/api/ng.$compile – Cherniv
我在這裏找到了更完整的答案:[link](http://stackoverflow.com/questions/9381926/insert- html-into-view-using-angularjs) – gianlucabr