AngularJS';s ng bind html指令不';无法正确显示无序列表
守则:AngularJS';s ng bind html指令不';无法正确显示无序列表,angularjs,Angularjs,守则: var appModule = angular.module('lookbookApp', [ 'ngSanitize', ]) appModule.filter('to_trusted', ['$sce', function ($sce) { return function (text) { return $sce.trustAsHtml(text); }; }]); <div class="text pre-t
var appModule = angular.module('lookbookApp',
[
'ngSanitize',
])
appModule.filter('to_trusted', ['$sce', function ($sce) {
return function (text) {
return $sce.trustAsHtml(text);
};
}]);
<div class="text pre-txt" ng-bind-html="caseStudy.Overview | to_trusted"></div>
var-appModule=angular.module('lookbookApp',
[
“消毒”,
])
appModule.filter('to_trusted',['$sce',函数($sce){
返回函数(文本){
返回$sce.trustAsHtml(文本);
};
}]);
案例研究的内容。概述:
<ul>
<li>aaaa</li>
<li>bbbb</li>
<li>cccc</li>
<li>dddd</li>
</ul>
- aaaa
- bbbb
- 中交
- dddd
预期产出:
- aaaa
- bbbb
- 中交
- dddd
您的代码运行良好
$scope.caseStudy = {
"Overview": "<ul><li>aaaa</li><li>bbbb</li><li>cccc</li><li>dddd</li></ul>"
};
$scope.caseStudy={
“概述”:“- aaaa
- bbbb
- ccc
- ddddd
”
};
请看一下。您的代码运行良好
$scope.caseStudy = {
"Overview": "<ul><li>aaaa</li><li>bbbb</li><li>cccc</li><li>dddd</li></ul>"
};
$scope.caseStudy={
“概述”:“- aaaa
- bbbb
- ccc
- ddddd
”
};
请查看。如果我理解正确,那么您希望呈现HTML而不是呈现文本 如果是这种情况,那么就不应该使用
ng bind html
ng绑定htmlng bind html
呈现html而不是显示html标记
看到区别了吗
使用此代码
你好,普朗克!
var-appModule=angular.module(“lookbookApp”,['ngSanitize']);
appModule.controller(“myCtrl”、[“$scope”、函数($scope){
$scope.test=“你好世界”;
$scope.caseStudy={};
$scope.caseStudy.Overview='- aaaa
- bbbbbb
- ccc
- ddddd
;
}]);
appModule.filter('to_trusted',['$sce',函数($sce){
返回函数(文本){
返回$sce.trustAsHtml(文本);
};
}]);
如果我理解正确,那么您希望呈现HTML而不是呈现文本
如果是这种情况,那么就不应该使用ng bind html
ng绑定htmlng bind html
呈现html而不是显示html标记
看到区别了吗
使用此代码
你好,普朗克!
var-appModule=angular.module(“lookbookApp”,['ngSanitize']);
appModule.controller(“myCtrl”、[“$scope”、函数($scope){
$scope.test=“你好世界”;
$scope.caseStudy={};
$scope.caseStudy.Overview='- aaaa
- bbbbbb
- ccc
- ddddd
;
}]);
appModule.filter('to_trusted',['$sce',函数($sce){
返回函数(文本){
返回$sce.trustAsHtml(文本);
};
}]);
案例研究的内容是什么。概述?您能显示您的预期产出吗?对我来说,它正在发挥作用|哪一个是角度版本?我猜你的文本或前文本CSS类在没有项目符号的情况下呈现列表。检查生成的HTML代码。案例研究的内容是什么。概述
?您能显示您的预期输出吗?对我来说,它正在工作|哪一个是角度版本?我猜你的文本或前文本CSS类在没有项目符号的情况下呈现列表。检查生成的HTML代码。请不要误解我的意思,但是你确定这个问题需要任何答案吗?因为没有问题?我需要呈现的HTML。@tesicg看到输出,HTML只是呈现的。请不要误解我的意思,但是你确定这个问题需要任何答案吗,既然没有什么问题?我需要呈现的HTML。@tesicg看到输出,HTML只被呈现。