I am currently facing an issue with an image that is being used with angular-cli
:
<img src="" style="width: 120px; padding-top: 10px" alt="" id="dishPhoto">
The image has a Base64 url named imgUrl. My intention is to set the image source using the following code:
let img = document.getElementById('dishPhoto');
img.setAttribute('src', this.imgUrl);
However, I encounter an error:
document.getElementById(...) is null
I would appreciate any assistance in resolving this issue. Thank you.