Skip to content

[Angular] Identifier 'required' is not defined. '__type' does not contain such a member #152

@Kurtz1993

Description

@Kurtz1993

property errors of AbstractControlDirective

I have the following code:

<div>
    <label for="fullname">Passenger name:</label>
    <input
      type="text"
      name="fullname"
      required
      #fullname="ngModel"
      [ngModel]="detail?.fullname">

      <div class="error" *ngIf="fullname.errors?.required && fullname.dirty">
        Passenger name is required.
      </div>
  </div>

By using a property inside the errors property of the ngModel reference it shows me that error.
This shouldn't be an error since it's valid syntax for template-driven forms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions