...

/

Solution: The Built-in `NgModel` Directive

Solution: The Built-in `NgModel` Directive

Let’s compare the task result with the expected result.

We'll cover the following...

Solution

Here’s an example of how the solution for this task may look:

<section>
  <p>Name:</p>
  <input type="text" [(ngModel)]="name">

  <p>E-mail:</p>
  <input type="email" [ngModel]="email" (ngModelChange)="onEmailChange($event)">

  <p>Agreement:</p>
  <input type="checkbox" [(ngModel)]="agreement">

  <hr>
  <button (click)="onSave()">Save</button>
</section>
The solution for the task

Solution explained

This solution uses the following two ways of binding ...