Real time changes

I have this code in one of my components

constructor(
    private platform: Platform,
    private storageIonic: NativeStorage,
  ) {
    this.platform.ready().then(() => {
      this.storageIonic.getItem('background').then((bg) => {
        var html = document.getElementById('chatDetails');
        html.style.setProperty('--background', 'url('+ bg.src +') no-repeat 0 0');
      }).catch(error => console.error(error));
    });
  }

This code is in charge of loading image from local storage and place it as background of my page, it works but the issue is:

When I change my background and back to this page it doesn’t update the background, either i must open another pages then back and see new image or i should totally close my app and re-open it.

I need to make this code works without requiring to open another page or closing app. Any idea on that?