How can I solve a problem of "Cannot set properties of null (setting 'innerHTML')"?
I have an Angular project in which I want to have a unique id for every elements, so I use this code:
How can I solve a problem of "Cannot set properties of null (setting 'innerHTML')"?
I have an Angular project in which I want to have a unique id for every elements, so I use this code:
Are you sure idAct is correct? I am not a daily Angular user, but in HTML it’s just id. Try replacing idAct with id.
Also try using the window.onload event:
window.onload = (event)=>{
document.getElementById("uniqueID").innerHTML = id()
}