I have an array in my child component's element
@Input() listAnswer: any;
changestyle(event)
{
let activeSpan = event.target;
this.listAnswer.push(activeSpan.innerText.trim());
}
I am passing this variable from the parent component
<app-child [listAnswer]="listAnswer"></app-child>
However, I encountered the following error:
ERROR TypeError: Cannot read properties of undefined (reading 'push')
This code was functioning correctly in the main component. Any suggestions? Thank you.