I try to Sanitize a Image URL but i will not work for me...
This is my code
home.component.ts
constructor(public dialog: MatDialog, private route: ActivatedRoute, private sanitization : DomSanitizer) {
}
user: any;
img: SafeStyle;
ngOnInit(): void {
this.route.data.subscribe((data: {user: any}) => { this.user = data.user;});
console.log('Data: ', this.user);
this.img = this.sanitization.bypassSecurityTrustStyle('url(${this.user.profileImagePath})');
}
home.component.html
<div class="create_post_avatar" ngIF='img'>
<img [src]='img'>
</div>
Can you please help me?