angular 2 clearing form value throws read only exception

Viewed 46

i have a chat app client and i want to clear the text area after i hit the send button.

the code looks like:

<form [formGroup]="chatForm" (ngSubmit)="sendChatMessage()">
        <ion-input type="text" formControlName="messageInput" placeholder="start typing..."></ion-input>
        <ion-buttons end>
            <button item-right ion-button clear type="submit" [disabled]="chatForm.controls['messageInput'].value === ''"><ion-icon name="ios-send" style="zoom:2.0;"></ion-icon></button>
        </ion-buttons>
    </form>

however, in the sendChatMessage() if i try to do chatForm.controls['messageInput'].value='' I get read only exception.

1 Answers
Related