問題:在使用過程當中遇到的問題就是:angularJS綁定不上值。後來找到一種能夠用的方式。php
html頁css
1 <div class="all"> 2 <script type="text/html" style="margin:auto;height:300px;width:100%;" ng-model="LogContent" meta-umeditor 3 meta-umeditor-config='all_config' 4 meta-umeditor-placeholder="請填寫日誌內容!"> 5 </script> 6 </div>
controller裏要初始化html
1 $scope.LogContent = ""; 2 $scope.all_config = {}; jquery
腳本引用git
<link href="http://dylike.github.io/meta.umeditor/bower_components/meta.umeditor/lib/umeditor/dist/utf8-php/themes/default/css/umeditor.css" type="text/css" rel="stylesheet"> <script src="http://dylike.github.io/meta.umeditor/bower_components/meta.umeditor/lib/umeditor/dist/utf8-php/third-party/jquery.min.js"></script> <script src="http://dylike.github.io/meta.umeditor/bower_components/meta.umeditor/lib/umeditor/dist/utf8-php/umeditor.min.js"></script> <script src="http://dylike.github.io/meta.umeditor/bower_components/meta.umeditor/lib/umeditor/dist/utf8-php/umeditor.config.js"></script> <script src="http://dylike.github.io/meta.umeditor/bower_components/meta.umeditor/src/meta.umeditor.js"></script>
這樣就能夠用了。github
【問題描述】瀏覽器
這時取到的數據中帶有各類各樣的html標籤,angularJs輸出html的時候,瀏覽器並不解析這些html標籤安全
咱們用ng-bind-html這樣的指令來綁定,瀏覽器中顯示的仍是html代碼。spa
【解決辦法---$sce】日誌
經過使用$ sce.trustAsHtml()。該方法將值轉換爲特權所接受並能安全地使用「ng-bind-html」
要這樣設置一下logList[i].LogContent = $sce.trustAsHtml(logList[i].LogContent);
就能夠獲得純文本了。
注:僅我的理解和總結,有誤處請各位指正