本文整理汇总了TypeScript中@angular/platform-browser.DomSanitizationService类的典型用法代码示例。如果您正苦于以下问题:TypeScript DomSanitizationService类的具体用法?TypeScript DomSanitizationService怎么用?TypeScript DomSanitizationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DomSanitizationService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(
private route: ActivatedRoute,
private challengesService: ChallengesService,
private identityService: IdentityService,
private sanitizer: DomSanitizationService) {
//this.introUrl = this.sanitizer.bypassSecurityTrustResourceUrl('https://www.youtube.com/embed/C-yYyvmjqfY?autoplay=1');
this.introUrl = this.sanitizer.bypassSecurityTrustResourceUrl('https://player.vimeo.com/video/301290028');
this.outroUrl = this.sanitizer.bypassSecurityTrustResourceUrl('https://player.vimeo.com/video/301290822');
}
示例2: 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');
}
示例3: ngOnInit
ngOnInit(){
this.showCode = sharpDox.projectData.showCode;
this.member.linkedSyntaxSanitized = this._sanitizer.bypassSecurityTrustHtml(this.member.linkedSyntax);
if(this.member.type == "method"){
this.member.sequenceDiagramSanitized = this._sanitizer.bypassSecurityTrustHtml(this.member.sequenceDiagram);
}
}
示例4: ngOnInit
ngOnInit() {
//console.log(this.assignmentDetail);
this.myresponse = this.assignmentDetail["responses"][this.email];
//console.log(this.myresponse);
this.assignment_url = this.myresponse["attachmentUrl"];
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(this.assignment_url);//WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
}
示例5: updateVideoUrl
// #docregion trust-video-url
updateVideoUrl(id: string) {
// Appending an ID to a YouTube URL is safe.
// Always make sure to construct SafeValue objects as close as possible to the input data, so
// that it's easier to check if the value is safe.
this.videoUrl =
this.sanitizer.bypassSecurityTrustResourceUrl('https://www.youtube.com/embed/' + id);
}
示例6:
.then((response) => {
const posts = response.json()
for (const post of posts) {
post.content.rendered = this.sanitizer.bypassSecurityTrustHtml(post.content.rendered)
}
return posts
})
示例7: transform
transform(value: string, args: any[]) {
if(!value)
return value;
return this.sanitizer.bypassSecurityTrustHtml(value);
}
示例8: InvalidPipeArgumentException
transform(value) {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
}
return this.sanitizer.bypassSecurityTrustHtml(value);
}
示例9: notify
notify(state : State) : void {
var currentPageData = state["SiteStateChanger.currentPageData"];
if(state.changedKeys.indexOf("SiteStateChanger.currentPageData") > -1 && currentPageData !== undefined){
this.currentPageData = state["SiteStateChanger.currentPageData"];
this.currentPageData.contentSanitized = this.sanitizer.bypassSecurityTrustHtml(this.currentPageData.content);
super.setChanged();
}
}
示例10: updateVideoUrl
// #docregion trust-video-url
updateVideoUrl(id: string) {
// Ajouter un ID à une URL YouTuve n'est pas risqué.
// Veillez à toujours construire des objets SafeValue aussi fidèles
// que possible aux données entrées afin de faciliter
// leur vérification.
this.urlDangereuseDeVideo = 'https://www.youtube.com/embed/' + id;
this.urlDeVideo =
this.sanitizer.bypassSecurityTrustResourceUrl(this.urlDangereuseDeVideo);
}