简体   繁体   English

Angular 使用 ngbdatepicker 抛出 RangerError: 超出最大调用堆栈大小

[英]Angular using ngbdatepicker throwing RangerError: Maximum call stack size exceeded

I am using the following code in my angular component template.我在我的 angular 组件模板中使用以下代码。

<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.将 ngbDatePicker 属性删除到输入元素不会引发错误。

在此处输入图像描述

im sure that you wrapped the input field in a form element and added我确定您将输入字段包装在表单元素中并添加

[formGroup]="searchForm " [formGroup]="searchForm"

right?正确的?

if so: is your input is in *ngFor?如果是这样:您的输入是否在 *ngFor 中?

if not: check your module, see if you added NgbModule or NgbDatePickerModule?如果没有:检查你的模块,看看你是否添加了 NgbModule 或 NgbDatePickerModule? had a similar problem, maybe it helps有类似的问题,也许它有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM