tôi đang học kiễu góc tìm kiếm một sự giúp đỡ trong sửa chữa các lỗi: tôi theo liên kết này: https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md để tạo ra một ứng dụng nhỏ góc với angular2 và angularfirestore2NullInjectorError: Không cung cấp cho AngularFirestore
nhưng khi tôi nhấn ng phục vụ tôi nhận được báo lỗi dưới đây trong trình duyệt của giao diện điều khiển ..
StaticInjectorError[AngularFirestore]:
StaticInjectorError[AngularFirestore]:
NullInjectorError: No provider for AngularFirestore!
at _NullInjector.get (core.js:923)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveNgModuleDep (core.js:10585)
at NgModuleRef_.get (core.js:11806)
at resolveDep (core.js:12302)
tôi đã cố gắng googling nó nhưng không tìm ra giải pháp chính xác không có gì làm việc cho tôi :(,
đây là wh tại I đã theo dõi: 1) Phiên bản Nút cài đặt 8.9.1 2) npm install -g @ angular/cli -> Phiên bản 1.5.2 3) ng new 'project-name' 4) npm install angularfire2 firebase - tiết kiệm
Dưới đây là app.module.ts tập tin của tôi:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularFireModule } from 'angularfire2';
import { environment } from '../environments/environment';
@NgModule({
imports: [
BrowserModule,
AngularFireModule.initializeApp(environment.firebase)
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
app.component.ts:
import { Component } from '@angular/core';
import { AngularFirestore } from 'angularfire2/firestore';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor(db: AngularFirestore) {
}
}
environemnt.ts:
export const environment = {
production: false,
firebase: {
apiKey: 'xxxxx',
authDomain: 'aaaaaaa',
databaseURL: 'bbbbbbbbbbbbbbbbbb',
projectId: 'aaaaaaaaaaaaaa',
storageBucket: 'aaaaaaaaaaaa',
messagingSenderId: 'aaaaaaaaaaaaa'
}
};
thì ng phục vụ, và tôi nhận được lỗi trên ..
Không thể giải quyết tất cả tham số cho AngularFirestore: ([object Object],?). lỗi này một lần nữa .. – Kumar
https://stackoverflow.com/questions/47026199/cant-resolve-all-parameters-for-angularfirestore-object-object – Sajeetharan
cuối cùng nó đã làm việc với liên kết trên nhờ @Sajeetharan – Kumar