0

I'm trying to fetch a value from a password field and use it in my code, this is the html section im using

<input type="password" maxlength="50" placeholder="Password"
          required [(ngModel)]="resetModel.password" name="password" required #password="ngModel">


<input type="password"  maxlength="50" placeholder="Confirm Password"
          required [(ngModel)]="resetModel.confirmPassword" name="confirmPassword" required #confirmPassword="ngModel">

nowI've initialized this resetModel object in my component.ts file

constructor(
public resetModel: Reset) { }

and I've a Reset class with these parameters,

export class Reset {
public password: string;
public confirmPassword: string;

constructor() {
this.password = '';
    this.confirmPassword = '';
}
}

but when I'm trying to load the webpage the following error is being shown

ERROR Error: Uncaught (in promise): Error: Template parse errors: There is no directive with "exportAs" set to "ngModel" ("holder="Password" required [(ngModel)]="resetModel.password" name="password" required [ERROR ->]#password="ngModel"> "): ng:///ResetPasswordModule/ResetPasswordComponent.html@30:82 Can't bind to 'ngModel' since it isn't a known property of 'input'. ( maxlength="50" placeholder="Password" required [ERROR ->][(ngModel)]="resetModel.password" name="password" required #password="ngModel">

Chris
  • 107
  • 1
  • 3
  • 13

0 Answers0