How can I programmatically close a FAB button list

2019-09-25 04:34发布

问题:

How can I programmatically close a FAB Button list in IONIC 3?

回答1:

1) In HTML

<ion-fab top right #fab>
  <ion-fab-list side="bottom">
    <button ion-fab (click)="Close($event, fab)">
        <ion-icon  name="trash"></ion-icon> 
      </button>
  </ion-fab-list>
</ion-fab>

2) In .TS

import {  FabContainer } from 'ionic-angular';
.
.
.
Close(event, fab: FabContainer) {
    fab.close();
}