当我单击向下箭头功能时,将显示记录;如果再次单击向下箭头功能,则应隐藏记录。但是隐藏功能不起作用。
1)如果未定义selectedAccountID,则单击功能应起作用并显示记录。
2)如果selectedAccountID未定义,则应隐藏记录
accountSelection(account) {
if (!this.selectedAccount || account.accountId !== this.selectedAccount.accountId) {
this.selectedAccount = account;
this.selectedAccountTransactions = this.transactionData.unrealizedGainLossDetails.filter(acc => acc.accountId === this.selectedAccount.accountId);
this.initialPaging();
} else {
this.selectedAccount = undefined;
this.selectedAccountTransactions = undefined;
this.unrealizedTransaction = undefined;
}
this.cd.detectChanges();
}
<li (click)="accountSelection(account)">
<i _ngcontent-c2="" aria-hidden="true" class=" fa fa-caret-down"></i>
</li>