1

I'm trying to validate a form with angular 6. Here's my PUG code:-

.form-group
  input.input-lg.form-control(type="text", 
    placeholder="Your firstname",
    name="fname",
    #fname="ngModel", 
    required)
    .alert.alert-danger(*ngIf="fname.invalid")
    p([hidden]="!fname.errors.required") First name is required`

and I get this error:

Uncaught Error: Template parse errors: There is no directive with "exportAs" set to "ngModel" (" ]#fname="ngModel" required="required"/>

I've already imported the FormsModule in the app.module.ts.

Graham
  • 6,577
  • 17
  • 55
  • 76
mohamed saad
  • 75
  • 2
  • 9

1 Answers1

0

I had a simmilar problem which I asked about in this question. Check the comment section. My problem was that i forgot to add the imports: [FormsModule, ... in the app.module.ts. Maybe this is your problem too.

Monset
  • 600
  • 4
  • 23