我的离子应用程序有问题。 我的应用程序通过$ .http(GET或POST)连接到服务器。当脚本成功下载数据时,我会将其显示在
{{data.description}}
我的问题是data.description有url的时候。在我的数据库描述中有链接
<小时/>修改
当我使用这种方法时:
.success(function(data){
// data.description = test(data.description);
$scope.task = data;
$rootScope.MyData = {
description : '<a href="http://google.com"> dasd</a>'
}
})
或
$scope.task = data;
$rootScope.MyData = {
description : data.description
}
并在html中:
{{MyData.description}}
答案 0 :(得分:1)
使用$ rootScope
$(".invisible-livingroom img").css("visibility", "hidden")
你的Html
$http.get(...).then(function (response) {
$rootScope.MyData = {
description : data.description
}
}, function (response) {
);
注意:MyData.description = http://google.com
答案 1 :(得分:0)
这是因为Angular逃避了大括号内的html。您可以将ngSanitize与ngBindHtml指令结合使用。所以你的代码就像:
<p ng-bind-html="MyData.description"></p>
请勿使用<a>
标记,因为该指令会将html放在您使用的任何标记内。