简体   繁体   中英

Angular 4 & PrimeNg: how to add and remove/hide tab-panels

I have a tabView and a list of tab-panels. Based on runtime conditions, I need to hide and unhide one of the tab panels. Can not find a way to do this using looking at their docs or here. Any suggestions?

In general is there a way to dynamically add and remove tab panels?

Code I am using now that is not working, my test syntax must be wrong:

                <div [ngSwitch]="isNEC">
                <ng-template ngSwitchCase="'true'">
                <p-tabView>
                    <p-tabPanel header="Detail">
                        <linechart #linechart></linechart>
                    </p-tabPanel>
                    <p-tabPanel header="Assessment">
                        Coming soon to a theater near you !!!!
                    </p-tabPanel>
                </p-tabView>
                </ng-template>
                <ng-template ngSwitchCase="'false'">
                    <p-tabView>
                        <p-tabPanel header="Detail">
                            <linechart #linechart></linechart>
                        </p-tabPanel>
                    </p-tabView>
                </ng-template>

            </div>

unless I put a switch default, nothing ever shows up. isNEC is a component public attribute of type string

一切都很好,我只需要检查“ true”而不是“ true”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM