TypeError: Cannot assign to read only property 'name' of function '

Viewed 7365

I was trying to type something in the input box but when I filled in my first letter it says cannot assign to read only property.

Here is my code

This is the code of the component: enter image description here

This is the input type: enter image description here

This is what is sitting in the topic:

enter image description here

1 Answers

It looks like you're not initializing the var topic: Topic which you are using to bind to <input [(ngModel)]...>. To get your current version working you would have to bind to selectedTopic instead and call your createNewContact() in the ngOnInit().

See: https://stackblitz.com/edit/angular-kxd2ze

Related