[ionic4] How to close FAB button in ionic4

How to close FAB button in ionic4… my code was working in ionic 3 to close FAB button but the same code is not working in ionic4… my code is given below:

<ion-fab vertical="bottom" horizontal="end" slot="fixed" #fab>
		<ion-fab-button color="primary">
			<ion-icon name="ios-options"></ion-icon>
		<ion-fab-list side="top">
			<ion-fab-button (click)="openSort(fab)"><ion-icon name="md-funnel"></ion-icon></ion-fab-button>
			<ion-fab-button (click)="openFilter(fab)"><ion-icon name="ios-funnel"></ion-icon></ion-fab-button>
        openFilter(fab) {		
		fab.close();    // this is not working in ionic 4

	openSort(fab) {		
		fab.close();  // this is not working in ionic 4

Some one plz help…


@pantarmj I haven’t used ion-fab in v4 so I don’t know how to solve that.

I looked at the v4 docs but they don’t have a javascript (angular) code example to access the fab button programatically.

I saw this issue that seems the same as yours, although the solution seems a bit hackish, but maybe it will work in your case too:

1 Like

Thanks dear… but the solution given in the link is not working for me @lucasbasquerotto … This is the code I have written in ts file to close the FAB button :


Glad that you were able to solve it. When the Ionic Team update the docs, I advise to use the official API to close the FAB button (assuming there will be a programatic way to close the button, like on v3).

1 Like

Thanks for your valuable advise dear. Surely will do as advised.