本文整理汇总了TypeScript中@angular/platform-browser.DomSanitizationService.bypassSecurityTrustUrl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DomSanitizationService.bypassSecurityTrustUrl方法的具体用法?TypeScript DomSanitizationService.bypassSecurityTrustUrl怎么用?TypeScript DomSanitizationService.bypassSecurityTrustUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/platform-browser.DomSanitizationService
的用法示例。
在下文中一共展示了DomSanitizationService.bypassSecurityTrustUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
// #docregion trust-url
constructor(private sanitizer: DomSanitizationService) {
// javascript: URLs are dangerous if attacker controlled. Angular sanitizes them in data
// binding, but we can explicitly tell Angular to trust this value:
this.dangerousUrl = sanitizer.bypassSecurityTrustUrl('javascript:alert("Hi there")');
// #enddocregion trust-url
this.updateVideoUrl('PUBnlbjZFAI');
}
示例2: constructor
// #docregion trust-url
constructor(private sanitizer: DomSanitizationService) {
// javascript : les URLs sont dangeureuses si elles sont contrôllées
// par un attaquant.
// Angular les sécurise lorsque les données sont liées mais il est possible
// de dire explicitement à Angular de faire confiance à ces données :
this.urlDangereuse = 'javascript:alert("Hi there")';
this.UrlDeConfiance = sanitizer.bypassSecurityTrustUrl(this.urlDangereuse);
// #enddocregion trust-url
this.updateVideoUrl('PUBnlbjZFAI');
}
示例3: constructor
constructor(dom: DomSanitizationService) {
this.LogoImage = dom
.bypassSecurityTrustUrl(
require('../../assets/rangleio-logo.svg')
);
}
示例4: ngOnInit
ngOnInit(){
this.url = this.sanitizer.bypassSecurityTrustUrl(this.item.image);
}
示例5:
this.stream.addEventListener('src-added', () => {
this.src=this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(this.stream.getWrStream()));
});
示例6: transform
transform(value:any, filter:string){
return this._sanitizationService.bypassSecurityTrustUrl(value);
}
示例7: safeurl
safeurl(link: string){
return this.sanitizer.bypassSecurityTrustUrl(link);
}