AngularFireModule from @angular/fire/compat not providing the database appropriately.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- angular, typescript
- Ambito
- database
Direzione di ricerca
Inizia riproducendo l’errore di injection con l’app.config.ts mostrato e il Postingservice che inietta AngularFireDatabase. Leggi la configurazione del database compat insieme alla configurazione del provider standalone, quindi verifica che AngularFireDatabase possa essere iniettato e che viewPosts() legga /posts senza l’errore No provider found.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
So I've been facing an issue for the past couple of days where whenever I try to use the AngularFireDatabase database to read or write to my Firebase database my console gives me the error:
No provider found for Database2. Source: Standalone[_Homecomponent].
I'm currently running Angular 20.0 as AngularFire 21.0 is yet to be fully fleshed out.
My dummy service to test the data looks like this below:
import { Injectable } from '@angular/core';
import { AngularFireDatabase } from '@angular/fire/compat/database';
@Injectable({
providedIn: 'root'
})
export class Postingservice {
constructor(private afDb:AngularFireDatabase){}
viewPosts(){
return this.afDb.list("/posts").valueChanges();
}
}
I've both tried instantiating the afDb in the constructor and using the inject() function and neither have worked to any avail.
Here also is my app.config.ts:
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { getDatabase, provideDatabase } from '@angular/fire/database';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideFirebaseApp(() =>
initializeApp({
// FIREBASE CONFIG DATA
})),
provideDatabase(() => getDatabase()),
]
};
I've even provided the provideDatabase() function even as it's not necessary for the AngularFireDatabase as a provider and likewise it's been to no avail...
And my application is bootstrapping correctly as it runs just fine until I create an instance of the afDb database in a component where I then get the above stated error. Kindly help.
- Lingua principale
- TypeScript
- Stelle
- 7.8k
- Fork
- 2.2k
- Merge medio
- 3g 6h
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di angular/angularfire
-
comp: build/pipeline type: bug version: current (v17+)
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
angular/angularfire#3766 ·
-
comp: schematics type: bug version: current (v17+)
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
angular/angularfire#3768 ·
-
comp: docs type: chore version: current (v17+)
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
angular/angularfire#3764 ·
-
comp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 assegnatario ·
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachable Apertacomp: core type: feature
angular/angularfire#3755 · 1 assegnatario ·
Tutte le issue di angular/angularfire
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
fil-donadoni/tolaria#4409 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
corsairdev/corsair#1764 ·