場景:背景放回一串資料帶有換行符 <br />,使用angularjs的時候,它會把換行符直接顯示儲來,不會換行。
解決方法:html标簽增加
ng-bind-html="mycontent"
<div ng-bind-html="mycontent" style="margin-left: 280px;margin-right: 280px"></div>
js代碼中引入:$sce
app.controller('myCon1', ["$scope", "$http", "$filter", "NgTableParams","$sce", function ($scope, $http, $filter, NgTableParams,$sce) {
...省略
$scope.mycontent= $sce.trustAsHtml(response.data);
...
ok,成功實作換行。