Close() not working in fab ionic-v4

import { Fab} from '@ionic/angular';
.........
@Component({
  selector: 'app-dashboard',
  templateUrl: 'dashboard.page.html',
  styleUrls: ['dashboard.page.scss'],
  providers: [ Fab ]
})
.........
constructor(public fab: Fab) { }
.........
closefab(){
    this.fab.close();
  }

error is:

core.js:1633 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'close' of null
TypeError: Cannot read property 'close' of null

The for pinging me, not sure I could help, what’s Fab again? :wink:

these buttons :smile:
49%20pm

Oh…and why you inject them as provider to call a method close?

because i got error

core.js:1633 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[DashboardPage -> Fab]: 
  StaticInjectorError(Platform: core)[DashboardPage -> Fab]: 
    NullInjectorError: No provider for Fab!
Error: NullInjectorError: No provider for Fab!

I mean what’s the goal of the feature?

Sorry like I said I don’t know much about it but since you pinged me I try to understand to help

1 Like

resolved without implementing anything :slight_smile: and thanks, atleast u tried :slight_smile:

did this only

var fabs = document.querySelectorAll('ion-fab');
    for (var i = 0; i < fabs.length; i++) {
      fabs[i].activated = false;
    }

I solved this issue by writing different code… plz refer below link: