<textarea #hello class="form-control" name="Input" type="text" rows="10" cols="40" [(ngModel)]="answer">
</textarea>
<div class="message">
{{ answer }}
</div>
transform(value: string): string {
return value.replace(/\\n/g, '<br />');
}
answer = '';
My goal is to allow users to input data, save it in a variable, manipulate it (e.g. replace certain characters), maintain its formatting, and then display it.
I am exploring the possibility of intercepting the data from ngModel before displaying it, making modifications, and then displaying it as intended by using normal ngModel functionality.
If this approach is not feasible, I would appreciate any advice on alternative methods to achieve my requirement. Any guidance would be helpful.