本文整理匯總了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);
}