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