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?
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 and thanks, atleast u tried
did this only
var fabs = document.querySelectorAll('ion-fab');
for (var i = 0; i < fabs.length; i++) {
fabs[i].activated = false;
}
3 Likes
I solved this issue by writing different code… plz refer below link:
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 :
document.getElementById('fab-btn').classList.remove('fab-button-close-active');
document.getElementById('fab-list').classList.remove('fab-list-active');
document.getElementById('fab-btn1').classList.remove('fab-button-show');
document.getElementById('fab-btn2').classList.remove('fab-button-show');