I'm working on angular 4 app. I have installed angular - 4.0.3, bootstrap - 3.3.7, ng-bootstrap - 1.0.0-alpha.15, @progress/kendo-angular-dateinputs - ^1.0.3.
I open modal dialog that have inside kendo-datepicker. When I click on open datepicker icon I have error:
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.
I tried to add
import { Component, OnInit, OnDestroy, AfterViewChecked, AfterContentChecked, ChangeDetectorRef } from '@angular/core';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { FormGroup, FormBuilder, FormControl } from '@angular/forms';
@Component({
selector: "ac-task-modal",
templateUrl: "./app/core/modals/task-modal.component.html"
})
export class AddTaskModalComponent implements OnInit, OnDestroy, AfterViewChecked, AfterContentChecked {
fromDate = new Date();
dueDate? = new Date();
taskForm: FormGroup;
constructor(private ref: ChangeDetectorRef,
public activeModal: NgbActiveModal,
private modalService: NgbModal,
private readonly formBuilder: FormBuilder) {
}
ngOnInit() {
this.buildForm();
}
ngAfterViewChecked(): void {
this.ref.detectChanges();
}
ngAfterContentChecked(): void {
this.ref.detectChanges();
}
buildForm() {
this.taskForm =
this.formBuilder.group({
description: this.task.description,
note: "",
assignee: new FormControl()
});
}
ngOnDestroy() {
}
}
But it didn't help. When I insert kendo-datepicker not in modal dialog, it works fine.
Where is the error into kendo-datepicker, ng-bootstrap or angular? And how can I resolve it?
Important note I have theme on my project for bootstrap v3, so I can't update ng-bootstrap to the latest version, because the latest versions for bootstrap v4, correct me if I'm wrong.