The property endDate
is not found on the type TestComponent
test.Component.cs
--
import { Component} from '@angular/core';
import { Router } from '@angular/router'
import {Message} from 'primeng/api';
import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms';
@Component({
templateUrl: './test.component.html',
selector: 'test',
providers:[TestService]
})
export class TestComponent {
public testingForm: FormGroup;
constructor(
private router: Router,
private userService: UserService,
,private formBuilder: FormBuilder
) {
console.log("Inside constructor...");
}
ngOnInit():void {
console.log("Inside onNotify ....");
this.testingForm = this.formBuilder.group({
startDate: new FormControl('', Validators.required),
endDate: new FormControl('', Validators.required),
message: new FormControl('', Validators.required)
});
this.loadData();
}
...////.....
}
--
test.component.html
--
<form [formGroup]="testingForm" >
<div>
<label class="control-label col-sm-4">Start Date:</label>
<div class="col-sm-8">
<p-calendar formControlName="endDate" [showIcon]="true"></p-calendar><span style="margin-left:35px">{{endDate|date}}</span>
</div>
</div>
</form>
app.module.ts
- includes the import for FormsModule
and ReactiveFormsModule
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
The error encountered:
ERROR in src/testing/test.component.html:37:115 - error TS2339: Property 'endDate' does not exist on type 'testingComponent'.
37 <p-calendar formControlName="endDate" [showIcon]="true"></p-calendar><span style="margin-left:35px">{{endDate|date}}</span>
~~~~~~~
src/testing/test.component.ts:19:16
19 templateUrl: './test.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component TestComponent.
Your feedback is greatly valued. Thank you in advance.