Angular-calendar: Angular 10.0

Created on 25 Jun 2020  路  5Comments  路  Source: mattlewis92/angular-calendar

Describe the bug

Hello together,

i update Angular 9 to Angular 10.

Now i get this error message. Somebody know what to do?

Greetings Bj枚rn

ERROR Error: Cannot instantiate cyclic dependency! DateAdapter
at throwCyclicDependencyError (core.js:5357)
at R3Injector.hydrate (core.js:11262)
at R3Injector.get (core.js:11088)
at NgModuleRef$1.get (core.js:23982)
at Object.get (core.js:22238)
at getOrCreateInjectable (core.js:3799)
at Module.傻傻directiveInject (core.js:13770)
at NodeInjectorFactory.CalendarPreviousViewDirective_Factory [as factory] (angular-calendar.js:917)
at getNodeInjectable (core.js:3907)
at instantiateAllDirectives (core.js:8022)

Minimal reproduction of the problem with instructions

Screenshots

Versions

  • @angular/core: 10.0
  • angular-calendar: latest
  • Browser name and version: chrome

Most helpful comment

I managed to do quick (ugly) fix until update comes:
at the end of the module:

import * as tslib_1 from 'tslib'
import * as date_fns_2 from 'date-fns'

function adapterFactory() {
  return tslib_1.__assign(tslib_1.__assign({}),date_fns_2);
}

and in imports:

imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    MatSelectModule,
    MatTooltipModule,
    CalendarModule.forRoot({ provide: DateAdapter, useFactory: adapterFactory }),
  ...
  ],

At least it works for me, its something wrong with adapterFactory. not all functions are being created

All 5 comments

Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me

I managed to do quick (ugly) fix until update comes:
at the end of the module:

import * as tslib_1 from 'tslib'
import * as date_fns_2 from 'date-fns'

function adapterFactory() {
  return tslib_1.__assign(tslib_1.__assign({}),date_fns_2);
}

and in imports:

imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    MatSelectModule,
    MatTooltipModule,
    CalendarModule.forRoot({ provide: DateAdapter, useFactory: adapterFactory }),
  ...
  ],

At least it works for me, its something wrong with adapterFactory. not all functions are being created

Hey there, sorry to hear you're having issues, the problem is a bug with the angular cli itself (https://github.com/angular/angular-cli/issues/17967) and there is a fix in the works. Unfortunately you'll have to wait until 10.0.1 of the angular cli is released (sometime next week probably). Closing as a dupe of https://github.com/mattlewis92/angular-calendar/issues/1288

@jasonkonopacki there is no 10.0.2 version of the cli, it's still on 10.0.0: https://www.npmjs.com/package/@angular/cli

@mattlewis92 Thanks for the clarification - @angular/[email protected] fixed the issue. Thank you!

Was this page helpful?
0 / 5 - 0 ratings