草庐IT

DomSanitizer

全部标签

javascript - 使用 Angular 2 RC6 向组件提供 DomSanitizer 的正确方法

我正在尝试使用DomSanitizer清理组件中的动态URL我似乎无法弄清楚为此服务指定提供程序的正确方法是什么。我正在使用Angular2.0.0-rc.6这是我当前的组件:@Component({templateUrl:'./app.component.html',styleUrls:['./app.component.css'],providers:[DomSanitizer],})exportclassAppComponentimplementsOnInit{publicurl:SafeResourceUrl;constructor(privatesanitizer:DomSa