哪个图书馆最适合消毒?由于它对安全性很有用,但是由于我们在angularjs中为依赖注入了依赖性,因此在angular6中实现的最佳方法是什么?
答案 0 :(得分:0)
//Import module first in your component -
import { DomSanitizer } from '@angular/platform-browser';
// Create object for that inside constructor like below --
constructor(public _domSanitizationService: DomSanitizer) {}
// In your HTML file use like below.
<img [src]="_domSanitizationService.bypassSecurityTrustUrl(url) />