Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
Dynamic tabs with routing
posted

I am using Angular 11 and latest IG (Dec 2020 release), as I am on a brand new Ignite UI license.

I am unsure how to go about dynamically creating a tab, with a routerlink to another component (with parameter).

Example:

Tab:Scenarios (list of scenarios with header info)

User clicks "Manage" in unbound "Actions" column, should:

  1. Create a tab with scenario.name as tab.title and navigate to /details/<scenario.id>
  2. Scenario List should not reload when navigated back to, unless header info changed in /details
  3. Button to delete /details tab removes from tab bar and navigates user back to most previously active tab

Parents Reply
  • 2680
    Offline posted in reply to Chris Sworen
    Hello Chris,

     

    Based on your latest query, I created this new sample in an effort to get closer to your requirement.
    Please, note that the sample uses the latest Ignite UI version 12.0.0 to make use of the improved API for the IgxTabsComponent. For more information regarding the breaking changes in v. 12.0.0 please, refer to our release page in GitHub here. The Tabs documentation page is also updated. 

     

    The latest sample aims to replicate the described by you setup and is better structured. Additionally, for demo purposes, I added a guard service, implementing the CanActivate interface, so that a “details/:id” url cannot be accessed unless a tab with the given id is among the globally-stored currently opened tab-ids array.

     

    However, please, keep in mind that discussing any application-level logic and data-model-related features would be out of the scope of this thread.

     

    Please, test the suggested sample on your side and let me know if it better demonstrates what you are trying to achieve.

     

    Best regards,
    Bozhidara Pachilova
    Associate Software Developer
Children