use ngstyle in angular code example
Example 1: ngstyle
<div [ngStyle]="{'background-color':person.country === 'UK' ? 'green' : 'red' }"></<div>
Example 2: ngStyle
[ngStyle]="{'background-image': 'url(' + data.headerImage + ')'}"
<div [ngStyle]="{'background-color':person.country === 'UK' ? 'green' : 'red' }"></<div>
[ngStyle]="{'background-image': 'url(' + data.headerImage + ')'}"