Just starting out with Angular and experimenting with Angular forms. Even though I followed a tutorial and copied the code below, I keep encountering the following error:
Property 'updateEmployeeName' does not exist on type 'ContactFormComponent'
Here is the TypeScript code:
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component({
selector: 'app-contact-form',
templateUrl: './contact-form.component.html',
styleUrls: ['./contact-form.component.css']
})
export class ContactFormComponent {
employeeName = new FormControl('');
updateEmployeeName() {
this.employeeName.setValue('John');
}
}
And here is the corresponding HTML code:
<label>
Employee Name:
<input type="text" [formControl]="employeeName">
</label>