Trying to update a div that lives within a component
with innerHTML
, value depends on user interaction. The data comes in correct by http
but it only updates when I click into the component, not when drawerHTML
is updated.
EDIT: I forgot to mention that drawerHTML
is set from within a cordova plugin of Google Maps marker click callback. I believe this is the culprit because it might be running in an asynced callback that sets the value, but seems does not call for an update of the element.
marker.addEventListener(GoogleMapsEvent.MARKER_CLICK).subscribe((data) => {
this._myProvider.getData(marker.getTitle()).subscribe((data) =>{
this.drawerHTML = this._prepare(data);
console.log(this.drawerHTML);
});
});
This is where it's shown:
<content-drawer [options]="drawerOptions">
<ion-toolbar>
<ion-buttons start>
<button ion-button color="light" clear (click)="showDrawer()">
showDrawer
</button>
</ion-buttons>
</ion-toolbar>
<ion-content>
<div [innerHTML]="drawerHTML">
</div>
<button ion-button round small (click)="hideDrawer()">Close</button>
</ion-content>
</content-drawer>
content-drawer
setup as a ionic / angular component in a separate file
with content-drawer.html
as:
<ion-content>
<ng-content></ng-content>
</ion-content>
and the above code projected from my home into ng-content
.
Seems I have to make content-drawer
update itself manually since data is not updated at runtime? The DOM tree has to be updated?
The content-drawer is based on this implementation.