URL with spaces will not get interpreted directly,
Try this,
<div class="artist-banner fluid-banner-wrapper" [ngStyle]="alertStyles">
In component,
alertStyles = {
'background-image': 'url(../imgs/banner/' + this.event?.category.replace(" ", "%20") + '.jpg)'
};
Example:
@Component({
selector: 'app-style-example',
template: `
<div class="artist-banner fluid-banner-wrapper" [ngStyle]="alertStyles">
`
})
export class StyleExampleComponent {
alertStyles = {
'background-image': 'url(../imgs/banner/' + this.event?.category.replace(" ", "%20") + '.jpg)'
};
}
Edit: If yor are looping the event, you should pass event parameter
@Component({
selector: 'app-style-example',
template: `
<div class="artist-banner fluid-banner-wrapper" [ngStyle]="changeStyle(event)">
`
})
export class StyleExampleComponent {
}
changeStyle(event) {
return {
'background-image': 'url(../imgs/banner/' + event?.category.replace(" ", "%20") + '.jpg)'
}
}