0

I am trying to place Angular bootstrap Tab inside Angular bootstrap Modal, The thing is, Angular doesn't allow to render ng-template inside ng-template, so Angular bootstrap tab contents are not showing inside Angular bootstrap tab.

Here is the code for modal and tabs

<button
    type="button"
    class="btn btn-primary"
    (click)="openModal(el, modal)" 
>
    config
</button>

<ng-template
    #modal
    let-modal
    let-c="close"
    let-d="dismiss"
>
<ul
    ngbNav
    #nav="ngbNav"
    [(activeId)]="activeTab"
    class="nav-tabs"
>
<li [ngbNavItem]="1">
    <a ngbNavLink>First</a>
    <ng-template NgbNavContent>
        <p>This is first tab</p>
    </ng-template>
</li>
<li [ngbNavItem]="2">
    <a ngbNavLink>Second</a>
    <ng-template NgbNavContent>
        <p>This is second tab</p>
    </ng-template>
</li>

All I want to know if there is a way to find out to place bootstrap tabs inside bootstrap modal

Thanks in advance

3
  • Just create the modal as a separate component instead of ng-template. And then inside the component you can add the tabs. Commented Jun 10, 2021 at 18:36
  • Did you already consider moving the tabs into a separate component and put this in the modal? Seems to me like a way to avoid the "nested ng-template" situation. Commented Jun 10, 2021 at 18:37
  • thanks , is there any other way to figure it out? Commented Jun 10, 2021 at 18:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.