More Info:
I have a list of items. Each item is an instance of a MyClass
. MyClass
has a property text
and a method someMethod()
that returns this property.
I have an *ngFor
that lists all items on the page and when I click one of them (click)="currentItem = item"
is executed and the [value]="someMethod()"
is actually [value]="currentItem.someMethod()"
, so the selected item's text is written into the textarea.
I'm using Reactive forms and have the following in my template:
<textarea formControlName="myTextarea" [value]="someMethod()" ...
When the page renders and someMethod()
outputs a string, I can see that string displaying inside the textarea.
However, the value
property of the FormControl
is not updated. Why?