I developed an Angular application to test Firebase functions and deployed it on Firebase hosting. Almost everything is working except for the Firestore function, which is causing this error:
main.8ae925009adf8b80e1bc.js:1 ERROR Error: Uncaught (in promise): TypeError: AT(...).firestore is not a function
TypeError: AT(...).firestore is not a function
I am unsure why this error is occurring as everything works fine in my local environment. Here is the link to the app:
The library I am using includes these dependencies:
"dependencies": {
"@angular/animations": "~7.2.0",
...
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/cli": "^7.2.0",
...
"typescript": "~3.1.1"
}
This is part of my app module:
@NgModule({
declarations: [
AppComponent,
MenuComponent
],
imports: [
BrowserModule,
...
],
providers: [PolicyService, AngularFirestore],
bootstrap: [AppComponent]
})
Here is the userService where I call for data:
constructor(private firestore: AngularFirestore) {}
getUsers(): Observable<any> {
return this.firestore.collection('user', x => x.orderBy('jerk', 'asc')).snapshotChanges();
}
And this is the code from the component:
ngOnInit() {
this.db.getUsers().subscribe(v => this.items = v.map(v =>{
const data = v.payload.doc.data();
data.id = v.payload.doc.id;
return data;
}));
}