I have a textarea
and need to calculate how many characters have been typed into it.
Both of the following solutions work correctly—which would be preferable, and why? Is there an even better way to implement it?
Option A:
<textarea
id="descriptionEducation"
name="description"
rows="5"
[(ngModel)]="fruit.description"></textarea>
<div class="form-row__description">
You have written {{ fruit.description.length }} characters
</div>
Option B:
<textarea
id="descriptionEducation"
name="description"
rows="5"
[ngModel]="fruit.description" #descriptionFruit></textarea>
<div class="form-row__description">
You have written {{ descriptionFruit.value.length }} characters
</div>