调用 API 获取数据时获取 XSS 漏洞。所以试图添加DOMSANITIZER
,但它失败了。尝试以下代码,请建议我解决方案。
this.http.get(this.domSanitizer.bypassSecurityTrustUrl(dataUrl),{headers:headers}).subscribe(response => {
this.persons = response.data.map(x=>({...x,check:false,test:x.firstName}));
this.dtTrigger.next();
});