Issue
I have an input with ngDatePicker
and a submit button which is disabled as long as the form is not valid.
What's happening is that the form is always not valid! I've print the invalid form attribute and it's the date
part.
I don't know why it's always giving me invalid, even tough I printed the form value after selecting the date and it have a date
control name.
Anyone have an idea about the issue?
Here's how I'm building the form:
this.submitUserForm = formBuilder.group({
email: [null, Validators.required],
password: [null, Validators.required],
firstName: [null, Validators.required],
lastName: [null, Validators.required],
date: [null, Validators.required],
phoneNumber: [null, Validators.required],
gender: [null, Validators.required],
roles: [null, Validators.required]
});
And here's my HTML:
<input class="form-control" placeholder="Date of birth" name="dp" ngbDatepicker
#d_2="ngbDatepicker" formControlName="date" (click)="d_2.toggle()" [maxDate]="maxDateValue"
onkeydown="return false" (dateSelect)="onEndDateChange($event)">
Solution
This seems suspect: [maxDate]="minDateValue"
It appears that you are applying your minDateValue as the upper bound which makes reasonable input appear unreasonable.
Answered By - vsfDawg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.