Angular sanitize/ng-bind-html无法正常工作?

Tim*_*ter 51 angularjs ng-bind-html ngsanitize

我有一个转发器设置,只要其中没有html,就可以显示数据.

我已经包括angular-sanitize.js并尝试过使用ng-bind-html

但是跨度内没有显示任何内容,只在ng-bind-html属性中显示.所以看起来卫生处理不起作用,

我读到这需要添加到应用程序依赖项,但不知道在哪里这样做.

我刚刚在角度站点上工作,所以只有一个非常基本的控制器设置在一分钟.

Dan*_*Dan 125

  1. 您需要包含angular-sanitize.js http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-sanitize.js

  2. 将" ngSanitize " 添加到模块依赖项中

    var myApp = angular.module('myApp',['ngSanitize']);

  3. 不要{{}}在属性中使用

    <h1 ng-bind-html ="item.title"> </ h1>

  4. 不要用 $sce.trustAsHtml()


Tim*_*ter 7

我的解决方案是从这里下载js文件

http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-sanitize.js

我一直在使用我在角度git repo中找到的那个,