【发布时间】:2015-06-01 00:09:13
【问题描述】:
我是 AngularJs 的初学者,这是我的第一次尝试
我正在尝试显示来自 json 链接的数据,并且某些字段包含 html
这里是json内容:
[{"titre":"Titre18","description":"<p>test<\/p>"},{"titre":"Titre18f","description":"<p>sdfsdfsd<\/p>"}]
我使用这个 angularJs 代码来显示数据
<div ng-app="myApp" ng-controller="customersCtrl">
<ul>
<li ng-repeat="x in names">
{{x.titre}}
{{x.description}}
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("JSONLINK")
.success(function (response) {$scope.names = response;});
});
</script>
问题是,字段描述显示在 json 中:
- Titre18 <p>test</p>
- Titre18f <p>sdfsdfsd</p>
是否可以将此字段格式化为 html ? 我希望 p 标签被解释为 html
我使用 angularJs 1.3.15
非常感谢
【问题讨论】: