0
在下面的代碼中如何轉義特殊字符來顯示html?Angularjs如何轉義特殊字符
$scope.template_html='\u003cdiv class\u003d\"modal-body add_ticket\" id\u003d\"mymodal\"\u003e\r\n'
模板
<div ng-bind-html="template_html"></div>
在下面的代碼中如何轉義特殊字符來顯示html?Angularjs如何轉義特殊字符
$scope.template_html='\u003cdiv class\u003d\"modal-body add_ticket\" id\u003d\"mymodal\"\u003e\r\n'
模板
<div ng-bind-html="template_html"></div>
在控制器呼叫decodeURIComponent。
> decodeURIComponent('\u003cdiv class\u003d\"modal-body \" id\u003d\"mymodal\"\u003e\r\n')"
<div class="modal-body" id="mymodal">
要逃脫哪些字符? Newline已經被轉義了(上帝知道你爲什麼要在一個HTML字符串中換行),並且只有你知道尖括號被代碼替換,'''逃脫了,儘管絕對沒有理由這樣做。這個字符串。 – zeroflagL