I have 3 tabs on an Angular 8 page and I'm trying to get one of the tabs to either no longer display or at least to stop displaying its content when a variable equals zero. I've tried a few things so far.
Here is the tab:
<tab heading="{{counter}}" id="counter" [hidden]="counter == 0"></tab>
I tried this with and without the following line in the styles.css and in the component css, as a page I found on the web suggested:
[hidden] { display: none !important; }
Here is the variable in the component ts file:
counter: number;
The variable gets set by an array coming in from an API call, this all appears to be working fine:
this.counter = this.messagesArray.length;
The interpolation on the tab tag works and shows "0" and when logging to the console the count also shows "0" but the conditions in the tab do not hide or change the content.
I also tried ngClass:
<tab heading="{{counter}}" id="counter" [ngClass]="{'counterHide' : counter == 0}"></tab>
None of these change the tab or its content.
Do other approaches exist? Has anyone had any success with dynamically altering ngx-bootstrap tabs? Should I try a different tabset?
Thank you!
*ngIf="counter != 0"on the tab tag.::ng-deepwith your custom class on your component scss. Moreover, you could do[customClass]="count == 0 ? '' : 'hidden'".