Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Angular 14.2 - Error: inject() must be called from an injection context #1677

@mmoreno79

Description

@mmoreno79

🪲 bug report

After upgrading to Angular 14.2, we are getting the following exception when navigating to a component with the angular datatables on it:

Error: inject() must be called from an injection context
    at injectInjectorOnly (http://localhost:44410/vendor.js:52632:11)
    at ɵɵinject (http://localhost:44410/vendor.js:52648:55)
    at Module.ɵɵdirectiveInject (http://localhost:44410/vendor.js:75080:29)
    at NodeInjectorFactory.DataTableDirective_Factory [as factory] (http://localhost:44410/vendor.js:108429:105)
    at getNodeInjectable (http://localhost:44410/vendor.js:144323:38)
    at instantiateAllDirectives (http://localhost:44410/vendor.js:155193:23)
    at createDirectivesInstances (http://localhost:44410/vendor.js:154526:3)
    at Module.ɵɵelementStart (http://localhost:44410/vendor.js:158142:5)
    at UserListComponent_Template (http://localhost:44410/src_app_components_management_user_user_module_ts.js:369:69)
    at executeTemplate (http://localhost:44410/vendor.js:154488:5)
    at resolvePromise (http://localhost:44410/polyfills.js:9200:19)
    at resolvePromise (http://localhost:44410/polyfills.js:9147:9)
    at http://localhost:44410/polyfills.js:9274:9
    at _ZoneDelegate.invokeTask (http://localhost:44410/polyfills.js:8221:171)
    at Object.onInvokeTask (http://localhost:44410/vendor.js:170698:25)
    at _ZoneDelegate.invokeTask (http://localhost:44410/polyfills.js:8221:54)
    at Zone.runTask (http://localhost:44410/polyfills.js:7982:37)
    at drainMicroTaskQueue (http://localhost:44410/polyfills.js:8430:23)

🔬 Minimal Reproduction

StackBlitz/GitHub Link:

Step-by-step Instructions:

🎱 Expected behavior

A clear and concise description of what you expected to happen.

📷 Screenshots

🌐 Your Environment

  • NodeJS version: 14.17.1
  • Angular version: 14.2.2
  • Angular CLI version: 14.2.2
  • jQuery version: 3.6.1
  • DataTables version: 1.12.1
  • angular-datatables version: 14.0.0

📝 Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions