document.body.appendChild(elem) compiles but doesn't display anything

I’ve written some sample code such as this

var button = document.createElement('button');

    button.innerText = "Add";

    button.onclick = function () {};



   var myImage: HTMLImageElement = new Image(100,100);
    myImage.src = '../../assets/images/black.png';

and nothing shows up when I run the code. How do I fix this?

This is extremely unidiomatic for an Angular app. Managing the DOM is the framework’s job, not something the app code should be doing directly.


addition what rapropos sad, is maybe your path wrong.

The path must be seen from index.html from your www folder. On a standard installion of your assets folder it should for an <img src='assets/…

Note, that you have by debugging in chrome two assets folders you can point to, but on device src/assets is not available.

Best regards, anna-liebt