[英]Not retrieve image from JSON in Mobile Angular Ui.(Angular Js)
[英]HTML text not rendered in proper way from JSON in MOBILE ANGULAR UI
我正在使用MOBILE ANGULAR UI框架。 當我從JSON檢索Text(include標簽)時,.html文件中的文本會顯示帶有標簽的文本。 我已經看到一個鏈接,但沒有得到解決方案。 此鏈接為AngularJS:將HTML插入視圖 。 我已經安裝了ngsanitize,但是當我將其包含在app.js中時,我的項目就什么也不顯示。
App.js
angular.module('Y', [
'ngRoute',
'mobile-angular-ui',
'Y.controllers.Main',
])
COTROLLER:
.controller('chooseProductDescription', function($scope, $http){
$http({
method:'get',
url:'http://www.json-generator.com/api/json/get/cgbdRjMVpe?indent=2',
header:{'Content-Type':'application/json'},
}).success(function(data,status,headers, config){
$scope.productDescription = data;
$scope.html = data;
$scope.trustedHtml = $sce.trustAsHtml($scope.html);
}).error(function(data, status,headers, config){
})
})
ngsanitize是強制性的文本視圖嗎? 但是我也嘗試了ngsanitize,我看到了另一個鏈接。 如何安裝ngSanitize?
我想為文本視圖提供簡單的解決方案。
HTML。
<div ng-repeat="cat in productDescription">
{{cat.product.fullDescription}}
</div>
我閱讀了很多次此鏈接( AngularJS:將HTML插入視圖 ),但直到現在我都沒有解決方案。 我正在使用移動角度ui框架,可能是它有不同的方法。
我只想在MOBILE ANGULAR UI的html頁面中顯示沒有標簽的文本。 請分享您的想法。
我想..您沒有正確包含ngSanitize
看到這個普拉克更好地理解..嘗試,包括.. angular-sanitize
后angular
和前的script
並在您的標記中
而不是使用{{cat.product.fullDescription}}
。
<span ng-bind-html="cat.product.fullDescription"></span>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.