bypassSecurityTrustResourceUrl can not read property


#1

I am creating post app using wp rest api v2. That’s holding youtube video url(s) in iframe.
So i am sanatizing youtube url then it’s throwing error

Uncaught (in promise): TypeError: Cannot read property ‘bypassSecurityTrustResourceUrl’ of undefined TypeError

Have a look of my code

export class SinglePage {
datas:any = [];
comments:any;
constructor(private navCtrl: NavController, params: NavParams, private http: Http, private sanitizer: DomSanitizer) {
this.datas.sanitizer.bypassSecurityTrustResourceUrl(“https://youtube.com”);
this.http.get(params.data.url+"/?_embed").subscribe(data=>{

  this.datas.push(data.json());
  this.http.get(data.json()._links.replies[0].href).subscribe(comment=>{
    this.comments = comment.json()
    
  });
  
});

}

}

Please help me out into this.
Thanks in advance


#2

bypassSecurityTrustResourceUrl returns the magic object representing the trusted URL, but you don’t seem to be doing anything with it.


#3

Thanks for your reply i tried bypassSecurityTrustResourceUrl many way but didn;t found any succesful result.
Could you please tell me how to use this into my code ?