Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

AngularFireModule from @angular/fire/compat not providing the database appropriately.

Đang mở
#3,683 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
angular, typescript
Lĩnh vực
database

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi injection với app.config.ts được cung cấp và Postingservice inject AngularFireDatabase. Đọc phần thiết lập cơ sở dữ liệu compat cùng với phần thiết lập standalone provider, sau đó xác minh rằng AngularFireDatabase có thể được inject và viewPosts() đọc /posts mà không gặp lỗi No provider found.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

comp: compat needs: more info type: bug version: current (v17+)

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:

Image

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:

Image

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:

Image

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.

Ngôn ngữ chính
TypeScript
Star
7.8k
Fork
2.2k
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angularfire

Tất cả issue của angular/angularfire

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.