this.sanitizer.bypassSecurityTrustResourceUrl(url) & WARNING: sanitizing unsafe style value url
this.sanitizer.bypassSecurityTrustResourceUrl(url) & WARNING: sanitizing unsafe style value url
yizhichao 发表于6个月前
this.sanitizer.bypassSecurityTrustResourceUrl(url) & WARNING: sanitizing unsafe style value url
  • 发表于 6个月前
  • 阅读 14
  • 收藏 0
  • 点赞 0
  • 评论 0

新睿云服务器60天免费使用,快来体验!>>>   

摘要: WARNING: sanitizing unsafe style value url

https://stackoverflow.com/questions/38593515/warning-sanitizing-unsafe-style-value-url

https://github.com/angular/angular/issues/13849

https://github.com/ionic-team/ionic/issues/7552

 

import { Pipe, PipeTransform } from '@angular/core';
import {DomSanitizer} from '@angular/platform-browser';
@Pipe({ 
	name: 'trustAsResourceUrl' 
})
export class TrustAsResourceUrlPipe implements PipeTransform {
	constructor(private sanitizer:DomSanitizer){}
	transform(url:string) {
		//let sanitizedUrl = this.sanitizer.bypassSecurityTrustUrl(url);
		//
		let sanitizedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
		return sanitizedUrl;
	}
}

 

 


<video id="videoPlay" width="100%" height="auto" webkit-playsinline=""
           playsinline=""
           preload="none" controls="controls" #player  [src]="resourceUrl" poster='{{resourceInfo.coverPath  || "http://appdownload.allcam.com.cn/cover/no_picture.png"  }}'></video>

 

  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
yizhichao
粉丝 10
博文 340
码字总数 271925
×
yizhichao
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: