Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.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)在Angular js senitize中不渲染图像_Javascript_Angularjs_Ng Bind Html_Ngsanitize - Fatal编程技术网

Javascript 使用(ng bind html)在Angular js senitize中不渲染图像

Javascript 使用(ng bind html)在Angular js senitize中不渲染图像,javascript,angularjs,ng-bind-html,ngsanitize,Javascript,Angularjs,Ng Bind Html,Ngsanitize,我是AngularJS的新手,我正在使用AngularJS开发一个单页应用程序我有一个textarea字段,我用它插入一些带有图像的文本。它正在成功地插入到表中,当我获取记录时,它对textarea工作正常,图像也在渲染。,当我使用ng bind html 图像是不渲染,只有html和文本是渲染 在上图中,红色标记圆圈是一幅图像 当我尝试使用ng bind html渲染时,图像未被渲染。您是否直接将图像数据传递给ng bind html像ng bind html=“imageData”?您需要

我是AngularJS的新手,我正在使用AngularJS开发一个单页应用程序
我有一个
textarea
字段,我用它插入一些带有图像的文本。

它正在成功地插入到表中,当我获取记录时,它对textarea工作正常,图像也在渲染。

,当我使用
ng bind html

  • 图像
    不渲染,只有
    html
    文本
    渲染
  • 在上图中,红色标记圆圈是一幅图像


    当我尝试使用
    ng bind html
    渲染时,图像未被渲染。

    您是否直接将图像数据传递给
    ng bind html
    像ng bind html=“imageData”?您需要在控制器/链接函数中通过$sce.trustAsHtml传递它。它告诉Angular解析HTML是安全的。您是否直接将图像数据传递给
    ng bind HTML
    像ng bind HTML=“imageData”?您需要通过控制器/链接函数中的$sce.trustAsHtml传递它。它告诉Angular解析HTML是安全的。