Как скрыть элементы в NativeScript Angular? - PullRequest
0 голосов
/ 16 апреля 2020

Я пытаюсь сделать пользовательское поведение свайпом (RadList).

Когда мы проводим вправо, я хочу скрыть id = "right-stack", когда влево, id = "left-stack ".

Но директива * ngIf не работает, происходит сбой приложения.

<RadListView
    [items]="_dataItems"
    swipeActions="true"
    (itemSwipeProgressStarted)="onSwipeCellStarted($event)"
    (itemSwipeProgressChanged)="onSwipeCellSwiping($event)">
    <ng-template tkListItemTemplate let-item="item">
        <StackLayout class="listItemStackLayout">
            <Label class="nameLabel" text="text"></Label>
            <Label class="nameLabel" [text]="item.name"></Label>
            <Label class="descriptionLabel" [text]="item.role"></Label>
        </StackLayout>
    </ng-template>
    <GridLayout *ngIf="isVisible" *tkListItemSwipeTemplate columns="*, auto, auto" id="left-stack" class="LeftlistItemSwipeGridLayout">
        <StackLayout class="archiveViewStackLayout" col="0">
            <Label text="ARCHIVE" verticalAlignment="center" horizontalAlignment="center"></Label>
        </StackLayout>
    </GridLayout>
    <GridLayout *ngIf="!isVisible" *tkListItemSwipeTemplate columns="*, auto, auto" id="right-stack" class="listItemSwipeGridLayout">
        <StackLayout class="deleteViewStackLayout" col="1">
            <Label text="DELETE" verticalAlignment="center" horizontalAlignment="center"></Label>
        </StackLayout>
    </GridLayout>
</RadListView>

В компоненте

public isVisible: boolean = true;
...