Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.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 警告:正在清理某些内容,请参阅http://g.co/ng/security#xss_Javascript_Angular_Angular2 Template - Fatal编程技术网

Javascript 警告:正在清理某些内容,请参阅http://g.co/ng/security#xss

Javascript 警告:正在清理某些内容,请参阅http://g.co/ng/security#xss,javascript,angular,angular2-template,Javascript,Angular,Angular2 Template,在我的角度样本中有这样的警告 警告:正在清理某些内容,请参阅 闪电战: 有人请帮我离开这里 提前谢谢 我已经尝试过这个解决方案 仍然会出现警告 getCellContent(e): string { if (e && e.targetCell.className.indexOf('e-valuescontent') > -1 ) { template = '<input type="checkbox">'; //Here, you

在我的角度样本中有这样的警告

警告:正在清理某些内容,请参阅

闪电战:

有人请帮我离开这里

提前谢谢

我已经尝试过这个解决方案

仍然会出现警告

getCellContent(e): string {


    if (e && e.targetCell.className.indexOf('e-valuescontent') > -1 ) {
        template = '<input type="checkbox">'; //Here,  you can append the html elements

    }
     else {
        template = '';
     }

    return this.sanitizer.sanitize(SecurityContext.HTML, template) || '';
}
getCellContent(e):字符串{
if(e&&e.targetCell.className.indexOf('e-valuescontent')>-1){
template='';//在这里,您可以附加html元素
}
否则{
模板=“”;
}
返回此.sanitizer.sanitize(SecurityContext.HTML,模板)| |“”;
}
警告:正在清理某些内容,请参见

您尝试过吗

return this.sanitizer.bypassSecurityTrustHtml(template);
而不是

return this.sanitizer.sanitize(SecurityContext.HTML, template) || '';
Angular需要信任通过innerHTML插入的html。此
绕过securitytrusthtml(模板)
方法将有所帮助。这对我有用。让我知道你的