Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度指令ng bind html在某些情况下不起作用_Javascript_Html_Angularjs_Ng Bind Html - Fatal编程技术网

Javascript 角度指令ng bind html在某些情况下不起作用

Javascript 角度指令ng bind html在某些情况下不起作用,javascript,html,angularjs,ng-bind-html,Javascript,Html,Angularjs,Ng Bind Html,我想我尝试了堆栈溢出的所有解决方案,但没有找到答案 我正在使用angular 1.4.4和ng repeat指令,我希望在表行中显示HTML注释。示例注释为“测试注释” 而且,当我写下这样的东西时,它也起作用了 <td ng-bind-html="'<b>abc</b>' | html"> <td> {{comment.Comment}} </td> 我的问题是,在我的示例中,如何使ng bind html工作?我构建了一个

我想我尝试了堆栈溢出的所有解决方案,但没有找到答案

我正在使用angular 1.4.4和ng repeat指令,我希望在表行中显示HTML注释。示例注释为“测试注释”

而且,当我写下这样的东西时,它也起作用了

<td ng-bind-html="'<b>abc</b>' | html">
<td>
    {{comment.Comment}}
</td>

我的问题是,在我的示例中,如何使ng bind html工作?

我构建了一个带有表的JSFIDLE,没有自定义过滤器,它可以正常工作。你确定你的应用程序模块中包含了ngSanitize吗?对已添加NgSanitize。我编辑了我的问题
<tbody ng-show="dataLoaded">
    <tr ng-repeat="comment in comments | filter: commentFilter | commentFilter: customCommentFilter | limitTo: 10 : (currentPage*10-10)">
        <td ng-bind="comment.Comment">
        </td>
    </tr>
</tbody>
<td>
    {{comment.Comment}}
</td>
(function () {
    'use strict';

    var app = angular.module('app', [
        // Angular modules 
        'ngCookies',
        'ngRoute',
        'ngAnimate',                    
        'ngSanitize',                    
    ]);
    ...
    ...
})();
<tbody ng-show="dataLoaded">
    <tr ng-repeat="comment in comments | filter: commentFilter | commentFilter: customCommentFilter | limitTo: 10 : (currentPage*10-10)">
        <td ng-bind="comment.Comment">
        </td>
    </tr>
</tbody>