What Angular template syntax can you use on this template-driven form field to access the field value and check for validation within the template markup?

    <input type=”text” ngModel
        name=”firstName”
        required
        minlength=”4″>
    <span *ngIf=””>Invalid field data</span>
  •  You can make use of a template reference variable and the exportAs feature that the ngModel directive has.
  •  You can use the ngModel directive in combination with the input field name.
  •  You can use a template reference variable for the HTML input element and then check the valid property off of that.
  •  It is not possible to get access to the field value with template-driven forms. You must use reactive forms for that.

Leave a Reply

Your email address will not be published. Required fields are marked *