#Angular elements, NullInjectorError: R3InjectorError. Which provider?

5 messages · Page 1 of 1 (latest)

kindred terrace
#

I am trying to create an angular element from a standalone component. When I run the exported code with the custom selector I get Uncaught NullInjectorError: R3InjectorError[i -> i -> i -> i]: NullInjectorError: No provider for i!
If I change the component to an empty dummy component it works, so the process of creating a custom element should be ok.
How can I find out more about which provider is missing?

ruby canopy
#

Do not build in production configuration.

kindred terrace
# ruby canopy Do not build in production configuration.

Thank you, I thought elements required production for some reason. But now I see it:
zone.js:148 Uncaught NullInjectorError: R3InjectorError[DataService -> DataService -> HttpClient -> HttpClient]:
NullInjectorError: No provider for HttpClient!

In main.ts I have

  const app = await createApplication({
    providers: [
      BrowserModule,
      HttpClientModule,
    ],
  });

Shouldn't that be enough?

ruby canopy
#

You're not supposed to provide modules.

#

I never used createApplication, but I'd go with

const app = await createApplication({
    providers: [provideHttpClient()],
  });