page code: < div id="d" * ngIf = "show" > < / div >
ts file: in the callback function for which the request is successful:
this.show = true;
document.getElementById ("d")
at this time it is null,. I guess because dom hasn"t been rendered yet, try to change the div, to
this.show = true;
setTimeout (() = > {
document.getElementById ("d");
}, 100);
you can get dom, at this time, but it is not clear whether this will be a problem. Is there a better way?