结果不正确 html element is get json in ionic 2
The result is incorrect html element is get json in ionic 2
我在 ionic 中使用了 get json。
$http.get($scope.webServiceUrl+"example.php")
.then(function(response){
$rootScope.lists = response.data;
});
我用 php
编写了网络服务
echo json_encode($data,JSON_HEX_TAG);
returnjson数据和打印页面
text: "<h1>enes</h1>"
Json [{"id":"0","text":"<h1>enes</h1>"}]
jsonviewer Image
打印到页面时的结果
enter image description here
不接受是html元素。我该如何解决?
我认为你必须使用 ng-bind-html 指令,如果你确定它是安全的并且可以呈现为未编码的 HTML。
<div ng-controller="ExampleController">
<p ng-bind-html="myHTML"></p>
</div>
我在 ionic 中使用了 get json。
$http.get($scope.webServiceUrl+"example.php")
.then(function(response){
$rootScope.lists = response.data;
});
我用 php
编写了网络服务echo json_encode($data,JSON_HEX_TAG);
returnjson数据和打印页面
text: "<h1>enes</h1>"
Json [{"id":"0","text":"<h1>enes</h1>"}]
jsonviewer Image
打印到页面时的结果
enter image description here
不接受是html元素。我该如何解决?
我认为你必须使用 ng-bind-html 指令,如果你确定它是安全的并且可以呈现为未编码的 HTML。
<div ng-controller="ExampleController">
<p ng-bind-html="myHTML"></p>
</div>