为什么在模块中包含ngSanitize时ng bind html不能在ng repeat中工作

为什么在模块中包含ngSanitize时ng bind html不能在ng repeat中工作,html,angularjs,Html,Angularjs,我是angular js的新手我想在ng repeat中绑定标签我放置了ng bind html和ng bind html不安全但不工作输出不提交 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angul

我是angular js的新手我想在ng repeat中绑定标签我放置了ng bind html和ng bind html不安全但不工作输出不提交

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>      

     <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-sanitize.js"></script>
 <script>
   var myApp=angular.module('myApp',['ngSanitize'])
   myApp.controller('myController',['$scope',function($scope){
       $scope.items=[{ht:"hi <br> joi",ft:"ji"}];
   }]);
    </script>


<body>
    <div ng-app='myApp' ng-controller='myController'>
       <div ng-repeat="r in items ">
           <p ng-bind-html-unsafe="{{r.ht}}"></p>
        </div>
        </div>
    </body>                                    

var myApp=angular.module('myApp',['ngSanitize']))
myApp.controller('myController',['$scope',函数($scope){
$scope.items=[{ht:“hi
joi”,ft:“ji”}]; }]);


ng sanitize脚本中缺少>标记

改变

/script>


如果您使用的是ng sanitize,则无需应用$sce筛选器来生成安全url

演示

var myApp=angular.module('myApp',['ngSanitize']))
myApp.controller('myController',['$scope','$sce',函数($scope,$sce){
$scope.items=[{ht:“hi joi”,ft:“ji”}];
}]);

ng sanitize脚本中缺少>标记

改变

/script>


如果您使用的是ng sanitize,则无需应用$sce筛选器来生成安全url

演示

var myApp=angular.module('myApp',['ngSanitize']))
myApp.controller('myController',['$scope','$sce',函数($scope,$sce){
$scope.items=[{ht:“hi joi”,ft:“ji”}];
}]);

需要使用
$sce
将数据绑定到
ng bind html

var myApp=angular.module('myApp',['ngSanitize']))
myApp.controller('myController',['$scope','$sce',函数($scope,$sce){
$scope.items=[{ht:“hi joi”,ft:“ji”}];
}]);
myApp.filter('safe',函数($sce){return$sce.trustAsHtml;})


需要使用
$sce
将数据绑定到
ng bind html

var myApp=angular.module('myApp',['ngSanitize']))
myApp.controller('myController',['$scope','$sce',函数($scope,$sce){
$scope.items=[{ht:“hi joi”,ft:“ji”}];
}]);
myApp.filter('safe',函数($sce){return$sce.trustAsHtml;})



如果我们使用标题标记,我们不明白您是什么saying@Sajeetharan我没想过过滤器。很好:如果我把这个放在这里,这就是我的名字like@banuprakash如果我们使用标题TagDad不明白你是什么,你想在Tag中添加ng bind html吗saying@Sajeetharan我没想过过滤器。很好:如果我把这个放在这里,这就是我的名字like@banuprakash你想在里面添加ng绑定html吗tag@banuprakash注射消毒液时你不需要$sce过滤器为什么我得不到输出为什么你得不到输出?删除它是什么意思复制我的问题代码并删除不安全的内容并检查it@banuprakash您不需要$sce过滤器注射消毒为什么我得不到输出为什么你得不到输出?删除它是什么意思复制我的问题代码,删除不安全的内容并检查它
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-sanitize.js">/script>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-sanitize.js"></script>