EasyUI Forum

General Category => EasyUI for Angular => Topic started by: softboy99 on February 02, 2018, 02:17:14 AM



Title: How to dynamically create a tabpanelcomponent and add it to an existed Tabs?
Post by: softboy99 on February 02, 2018, 02:17:14 AM
I use the way of angular dynamic loading. But failed with the following:

core.js:1440 ERROR Error: StaticInjectorError(AppModule)[TabPanelComponent -> TabsComponent]:
  StaticInjectorError(Platform: core)[TabPanelComponent -> TabsComponent]:
    NullInjectorError: No provider for TabsComponent!


Title: Re: How to dynamically create a tabpanelcomponent and add it to an existed Tabs?
Post by: jarry on February 02, 2018, 07:12:13 PM
Please look at this example https://www.jeasyui.com/demo-angular/main/index.php?plugin=Tabs&theme=material&dir=ltr&pitem=Dynamic%20Tab%20Content&sort=


Title: Re: How to dynamically create a tabpanelcomponent and add it to an existed Tabs?
Post by: softboy99 on February 03, 2018, 03:00:48 AM
Thanks a lot. In the sample, each time click "adddatagrid" button, it will add a new tab. Is it possible just allow the first time, when 2nd time or later just make the former 1st added tab active.


Title: Re: How to dynamically create a tabpanelcomponent and add it to an existed Tabs?
Post by: jarry on February 03, 2018, 06:19:00 PM
That's simple, you can detect the existing tab panel. If not create it otherwise select it. For more information please look at the example in previous post.


Title: Re: How to dynamically create a tabpanelcomponent and add it to an existed Tabs?
Post by: softboy99 on February 04, 2018, 10:35:42 PM
Is it possible to use component name string "Dy1Component" to load component, so that AppComponent doesn't depend on Dy1Component. Because may be there many commponents.