Now, let's implement some support so that we can send messages to particular groups:
- Import FormsModule into the main application module:
import { FormsModule } from '@angular/forms';
You are going to need it later to establish two-way binding to the message's text.
- Let's introduce the message editor. Append the following code to the messages.component.html template:
<div class="message-editor">
<mat-form-field class="message-editor-field">
<input
[(ngModel)]="newMessage"
matInput
placeholder="Message the group"
autocomplete="off"
(keyup.enter)="send()"
/>
</mat-form-field>
</div>
Here, we are binding the input element to the newMessage...