I'm trying to go through the Adam Freeman angular book, but many of the example don't work, I imagine due to new changes since it was written.
The issue I have is the following template doesn't work due to typescript not liking the event.target
<input type="text" class="form-control" (input)="selectedProduct=$event.target.value">
The selectedProduct is declared in the template component as show below (
export class ProductComponent {
selectedProduct: string = "";
}
I then tried this by casting it as a HTMLTextAreaElement but then it says possibly undefined
I also tried with the !
If anyone could explain how I get this to work that would be great as it seems like pulling teeth, cheers.


