0

I am using the following code in my angular component template.

<input
  type="text"
  (click)="dp.toggle()"
  ngbDatepicker
  #dp="ngbDatepicker"
  id="myDatePicker"
  autocomplete="off"
  placeholder="mm/dd/yyyy"
  placement="bottom-left"
  [maxDate]="maxDate"
  formControlName="modifiedAfter" />

form group:

the form in component is:
  searchForm = new FormGroup({
    modifiedAfter: new FormControl(null),
    name: new FormControl(null),
  }) as TypedFormGroup<SearchModel>;

Removing the ngbDatePicker attribute to the input element doesnt throw the error.

enter image description here

Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156

1 Answers1

0

im sure that you wrapped the input field in a form element and added

[formGroup]="searchForm "

right?

if so : is your input is in *ngFor ?

if not: check your module , see if you added NgbModule or NgbDatePickerModule? had a similar problem , maybe it helps

  • 1
    Answers here should offer straightforward solutions. To aquire additional information you should use comment instead. – joka00 Sep 26 '22 at 12:55