With this template
<img src="{{someDynamicImageSrcVar}}"
(load)="onImageLoad($event)"
[ngStyle]="getImageStyle()"
>
After the image is changed and loads, onImageLoad() updates some properties.
getImageStyle() {
const style = {
'width.px': this.naturalWidth,
'height.px': this.naturalHeight
};
console.log(style);
return style;
}
The framework calls getImageStyle() which returns a style like
{width: "500px", height: "400px"}
However, the DOM is not updated apart from the first time getImageStyle() was called.
The style never changes from the initial values.
What should I do to make the style update?