Ion toolbar background from backend

hey guys. I’m aware that a good method to set a ion-toolbar background is:

--background: url('assets/images/whatever.png')  center 100%;

When this background is different for each item I have on my database, how can I set this variable? I’m trying the following:

const element: any = document.getElementById('header');
element.style.background = this.event.get('backgroundImage').url();

It doesn’t work at all. Any tips? thanks!