Code snippet for sidebar service file related to dashboard component:
constructor(private db: AngularFireDatabase) {}
getUsers(): Observable<any[]> {
return this.db.list('/users').valueChanges();
}
Code snippet for dashboard component:
import { SidebarService } from './sidebar.service';
ngOnInit() {
this.fetchUsers();
}
fetchUsers(): void {
this.sidebarService.getUsers().subscribe(users => {
this.users = users;
this.filteredUsers = this.users;
}, error => {
console.error('Error fetching users:', error);
});
Error encountered in developer tools:
ERROR NullInjectorError: NullInjectorError: No provider for InjectionToken angularfire2.app.options!
Upon login/signup, the page turns white with dev tools errors and fails to redirect to the dashboard component (the URL remains stuck at http://localhost:4200/login or http://localhost:4200/signup).