I have a category.service.ts file in my Angular 13 project and I tried in a lots of way implement FirebaseDatabase but it is not working. The original sample code:
import { AngularFireDatabase } from 'angularfire2/database';
import { Injectable } from '@angular/core';
@Injectable()
export class CategoryService {
constructor(private db: AngularFireDatabase) {}
getCategories() {
return this.db.list('/categories', {
query: {
orderByChild: 'name'
}
});
}
}
product-form.component.ts
...
export class ProductFormComponent implements OnInit {
categories$;
constructor(categoryService: CategoryService, private productService: ProductService)
this.categories$ = categoryService.getCategories();
}
save(product) {
this.productService.create(product);
}
ngOnInit() {
}
My question is about that how can I use Angular Fire Database in Angular 13.3.0? In my package.json the versions:
"@angular/fire": "^7.3.0" "firebase": "^8.10.1"
The above sample code of the CategoryService does not work because compiler says that 'Module '"angularfire2/database"' has no exported member 'AngularFireDatabase'.ts(2305)'
How can I populate this category list and further going: how can I save a product in the above mentioned version of firebase?