Angular Inject Error

How to solve the Angular Inject Error? – inject() must be called from an injection context

Inhaltsverzeichnis
angular inject error

Error message

main.ts:12 Error: inject() must be called from an injection context
at injectInjectorOnly (core.js:934)
at Module.ɵɵinject (core.js:950)
at Object.MatCommonModule_Factory as factory
at R3Injector.hydrate (core.js:17113)
at R3Injector.get (core.js:16863)
at core.js:16909
at Set.forEach ()
at R3Injector._resolveInjectorDefTypes (core.js:16905)
at new NgModuleRef$1 (core.js:36493)
at NgModuleFactory$1.create (core.js:36592)

Solution

Add this line to your tsconfig.app.json

"paths": { "@angular/*": [ "./node_modules/@angular/*" ] }

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen