當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript platform-browser.DomSanitizationService類代碼示例

本文整理匯總了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');
     }
開發者ID:ryankwilson,項目名稱:challengeapp,代碼行數:9,代碼來源:challenges.component.ts

示例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');
 }
開發者ID:AndresRicardoTorres,項目名稱:angular.io,代碼行數:8,代碼來源:bypass-security.component.ts

示例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);
        }
    }
開發者ID:Geaz,項目名稱:SharpDox.Plugins.Html,代碼行數:8,代碼來源:member.component.ts

示例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!
 }
開發者ID:raviraju,項目名稱:teach2educateApp,代碼行數:7,代碼來源:student-resubmit.ts

示例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);
 }
開發者ID:AndresRicardoTorres,項目名稱:angular.io,代碼行數:8,代碼來源:bypass-security.component.ts

示例6:

 .then((response) => {
   const posts = response.json()
   for (const post of posts) {
     post.content.rendered = this.sanitizer.bypassSecurityTrustHtml(post.content.rendered)
   }
   return posts
 })
開發者ID:likr,項目名稱:wpapi-angular2-example,代碼行數:7,代碼來源:post.service.ts

示例7: transform

  transform(value: string, args: any[]) {

    if(!value)
      return value;

    return this.sanitizer.bypassSecurityTrustHtml(value);
  }
開發者ID:ottman,項目名稱:front-1,代碼行數:7,代碼來源:safe.ts

示例8: InvalidPipeArgumentException

  transform(value) {
    if (isBlank(value)) return value;
    if (!isString(value)) {
      throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
    }

    return this.sanitizer.bypassSecurityTrustHtml(value);
  }
開發者ID:ajeetkanojia,項目名稱:ReDoc,代碼行數:8,代碼來源:pipes.ts

示例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();
     }        
 } 
開發者ID:Geaz,項目名稱:SharpDox.Plugins.Html,代碼行數:8,代碼來源:article.component.ts

示例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);
 }
開發者ID:ClementVidal,項目名稱:angular-fr,代碼行數:10,代碼來源:bypass-security.component.ts


注:本文中的@angular/platform-browser.DomSanitizationService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。