Why does dependency injection not work when im using esbuild for building my Angular 17...

Discussão em 'Angular' iniciado por Jelle Schrans, Outubro 19, 2024.

  1. I want to migrate from "@angular-devkit/build-angular:browser" to "@angular-devkit/build-angular:browser" to speed up development. But the problem i get is that every time i start my application the following error gets logged in my console:

    NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with runInInjectionContext.

    As described in the Angular docs, i simply changed "@angular-devkit/build-angular:browser" to "@angular-devkit/build-angular:browser-esbuild" in my angular.json file. While no errors get logged in my vs code terminal, i keep seeing this error in the console in the browser. I expected this to work, since the docs said that this would be the only change i needed to make

    Continue reading...

Compartilhe esta Página