I think you are missing some thing here with formGroup
and formControlName
you should do:
myForm: FormGroup;
firstName="";
lastName="";
on ngOnInit
this.myForm = this.formBuilder.group({
firstName: [this.firstName],
lastName: [this.lastName]
});
this.myForm.controls['firstName'].valueChanges.subscribe(value => {
console.log(value);
});
and In HTML
<form [formGroup]="myForm">
...
<input name="firstName" [(ngModel)]="firstName" formControlName="firstName" placeholder="enter name"/>
<input name="lastName" [(ngModel)]="lastName" formControlName="lastName" placeholder="enter last name"/>
...
</form>