in component: private sanitization: DomSanitizer safeStyle(style:string):SafeStyle{ return this.sanitization.bypassSecurityTrustStyle(style); } in HTML [style.background]="safeStyle(color.style)"