Home > database >  How to use DOMSANITIZER(bypassSecurityTrustUrl) while calling the API
How to use DOMSANITIZER(bypassSecurityTrustUrl) while calling the API

Time:10-28

Getting XSS vulnerabilities while calling the API for fetching the data. So trying to add DOMSANITIZER, but its failing. Tried below code, please suggest me the solution.

 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();
    });

enter image description here

I have also save it and you can go there to check it. https://stackblitz.com/edit/column-names-as-tooltip-wcw1f7?file=app/app.component.ts

  • Related