I use read_CheckOuts to return the database but the ngFor doesn’t work
Here is my code:
crud.service.ts
import { AngularFireDatabase} from '@angular/fire/database';
export class CrudService {
constructor(
private db: AngularFireDatabase
) { }
read_CheckOuts() {
return this.db.list('/cart_checkouts');
}
}
check-out.component.ts
import { CrudService } from '../service/crud.service';
constructor(private crudService: CrudService)
this.crudService.read_CheckOuts().valueChanges().subscribe(data => {
this.cart_checkouts = data.map(e => {
return {
this:this.cart_checkouts = this.cart_checkouts
};
})
This is how I try to display the read data:
check-out.component.html
<div *ngFor="let out of cart_checkouts">
<div>
<h5>Product Name: {{out.product_name}}</h5>
<h6>quantity: {{out.quantity}} </h6>
<p>Price: {{out.product_price}}</p>
<img src="/assets/images/gallery/{{out.thumbnail}}">
</div>
</div>