I am trying to add a new element to a preexisting HTML element with Javascript however the class that I add has no effect. This function is called in ngOnInit()
renderHand ( cards:Array<string> )
{
var hand:HTMLElement = document.getElementById ( "hand-list-1" );
for ( var card of cards )
{
// Create card
var imgElement = document.createElement ( "img" );
// here
imgElement.src = `assets/cards/${card}.png`;
imgElement.classlist.add ( "card-img-style" );
var liElement = document.createElement ( "li" );
// and here
liElement.classList.add ( "card-in-hand" );
liElement.style.width = "75px";
liElement.style.height = "150px";
liElement.appendChild ( imgElement );
hand.appendChild ( liElement );
}
}
When I use chrome's inspector the the classes show up as you would expect under the element properties, however the actual css class values aren't populated. When I try to just embed this directly as html it works as expected.
Why does this not work specifically in Angular?