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.

Support for entryComponents?

See original GitHub issue

I am trying to add a component to my UI-Jar project that creates another component dynamically, and as such requires that I add that dynamically created component to the module’s entryComponents array. Obviously there isn’t support for entryComponents in TestBed.configureTestingModule, but I’ve had success in the past in my normal unit test spec files by doing the following after calling compileComponents().

TestBed.overrideModule(BrowserDynamicTestingModule, {
    set: {
        entryComponents: [ SomeDynamicComponent ]
    }
});

I tried doing that in my ui-jar specfile but am still getting the following error:

Error: No component factory found for SomeDynamicComponent. Did you add it to @NgModule.entryComponents?

Is this intended to be supported? Any insight into why it is not working, or what I could do differently?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nordingcommented, Jun 11, 2018

@thomasbottonari That’s a bug, I created #36. A workaround is to declare your “PopoverModule” outside the test file, then it will be defined correct.

1reaction
karan-kangcommented, Jun 9, 2018

I was able to get this working. Basically, you have to create another TestEntryModule with the declaration,export, and entry components.

And then import this TestEntryModule in your TestModule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entry components - Angular
An entry component is any component that Angular loads imperatively, (which means you're not referencing it in the template), by type. You specify...
Read more >
Bye-Bye entryComponents?. With angular 9, there ... - Medium
In this blog post, I will try to cover everything that might help you clear up all the thoughts you have around the...
Read more >
What is entryComponents in angular ngModule?
entryComponent is any component Angular loads imperatively. You can declare entryComponent by bootstrapping it in NgModule or in route ...
Read more >
Add support for entryComponents · Issue #100 · testing-library ...
Pinning the angular dependencies to 9.1.4, calling ngcc with --properties main and running the tests again it seems like Ivy is used correctly....
Read more >
Entry Components in Angular - What are they? - Coding Latte
In this post, we are going to look at Entry Components (loaded by Class and not selector) in Angular, what they are and...
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