I have a Utilities class with some static methods on it.
In one method I want to get an object and return a safe style of its image.
The issue is I need to use the DomSanitizer service, and I am unable to use it in static method. Here is the code:
export class Utilities{ constructor(private sanitizer:DomSanitizer){ } static getImageStyle(obj){ return this.sanitizer.bypassSecurityTrustStyle(`url(data:image/jpg;base64,${obj.image})`); } } Does this need to be done in a non-static method and I should create instance of the class every time I use this function?