SideDrawer's MyDrawerItem always shown although visibility collapsed set


#1

Hi,
The SideDrawer’s MyDrawerItem is always shown although visibility collapse set:

  <MyDrawerItem [visibility]="1==1? 'collapse' :'collapse'" title="search" route="/search" icon="&#xf144;" [isSelected]="isPageSelected('Search')"></MyDrawerItem>

Any way to solve it?
Thanks!


#2

I have to guess a bit because of the lack of context: are you using this template? https://github.com/NativeScript/template-drawer-navigation-ng

Then take a look at https://github.com/NativeScript/template-drawer-navigation-ng/blob/master/shared/my-drawer-item/my-drawer-item.component.html, which is the view implementation of MyDrawerItem and there’s no visibility attribute.

So either add that attribute in the component, or use *ngIf instead of visibility.


#3

I added visibility my-drawer-item html to:

<GridLayout
[visibility]=“title? ‘visible’ :‘collapse’”
columns=“auto, *” class=“sidedrawer-list-item” [class.selected]=“isSelected” (tap)=“onNavItemTap(route)”>
<Label col=“0” [text]=“icon” class=“fa”>
<Label col=“1” [text]=“title” class=“p-r-10”>

so now on my-drawer html I can set tittle this way:
<MyDrawerItem [title]=“config.venue? ‘Info’: null”