question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use inputs: No provider for InjectionToken ComponentInjector

See original GitHub issue

I need to use inputs for dynamic components. Since Angular does not have an easy way to do this, I found this module and gave it a try. When I use it passing just a component class, it’s working, renders properly. However, when I add inputs, I get such error:

StaticInjectorError(AppModule)[DynamicDirective ->InjectionToken ComponentInjector]:
NullInjectorError: No provider for InjectionToken ComponentInjector!

I’ve tried different notation just for checking (<ndc-dynamic [ndcDynamicComponent]="component" [ndcDynamicInputs]="inputs" and <ng-container *ngComponentOutlet="component; ndcDynamicInputs: inputs;), result is the same.

Any hints? angular: ^7.2.16 ng-dynamic-component: ^4.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gundcommented, Aug 21, 2020

What I meant is you may want to update to at least Angular v8 and then you will be able to use latest version of this library. But it is just an advise so you can eliminate all the bugs that were fixed since version 4.

I will close this issue then.

0reactions
sandyevelizcommented, Nov 17, 2021

What I meant is you may want to update to at least Angular v8 and then you will be able to use latest version of this library. But it is just an advise so you can eliminate all the bugs that were fixed since version 4.

I will close this issue then.

I have an app with Angular version in 8, and i upgrade to v6 and works, v5 throw the error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular InjectionToken throws 'No provider for InjectionToken'
For this I'm using an Injector , and loading the the service during ngOnInit . This works fine when using a string based...
Read more >
NG0201: No provider for {token} found! - Angular
A provider is a mapping that supplies a value that you can inject into the constructor of a class in your application. Read...
Read more >
Dependency Injection | AngularDart Community Documentation
Angular has its own dependency injection framework, and you really can't build an Angular app ... You have no control over the car's...
Read more >
React Context In Angular - DEV Community ‍ ‍
In other words, context can help you to pass down inputs/props ... will have the value of the Context because there's no provider...
Read more >
Testing Dependency Injection • Angular - codecraft.tv
We can resolve dependencies in our tests using a number of methods. ... the Component's Providers; Resolving via the Component's Injector; Summary; Listing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found