TypeScript @angular-core.Sanitizer类(方法)实例源码

下面列出了TypeScript @angular-core.Sanitizer 类(方法)源码代码实例,从而了解它的用法。

作者:Hub-of-all-Thing    项目:Rumpe   
transform(message: string, replaceUrls: boolean = false): SafeHtml {
    if (typeof message === 'string') {
      const html = replaceUrls ? SafeHtmlPipe.replaceUrlsWithHtmlLinks(message) : message;

      return this.sanitizer.sanitize(SecurityContext.HTML, html);
    } else {
      return message;
    }
  }

作者:xety    项目:jhipster-uaa-setu   
factory(alertOptions): any {
     var alert = {
         type: alertOptions.type,
         msg: this.sanitizer.sanitize(SecurityContext.HTML, alertOptions.msg),
         id: alertOptions.alertId,
         timeout: alertOptions.timeout,
         toast: alertOptions.toast,
         position: alertOptions.position ? alertOptions.position : 'top right',
         scoped: alertOptions.scoped,
         close: function (alerts) {
             return this.closeAlert(this.id, alerts);
         }
     };
     if (!alert.scoped) {
         this.alerts.push(alert);
     }
     return alert;
 }


问题


面经


文章

微信
公众号

扫码关注公众号