I don't even have a formControlName at all but I keep getting this error:
core.js:6260 ERROR Error: formControlName must be used with a parent formGroup directive. You'll want to add a formGroup
directive and pass it an existing FormGroup instance (you can create one in your class).
This is all I have in my code:
shopping-cart.component.html
{{product.name }}
{{product.price }}
shopping-cart.component.ts
import { Component, OnInit } from '@angular/core';
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database';
import { Observable } from 'rxjs';
import * as firebase from 'firebase/app';
@Component({
selector: 'app-shopping-cart',
templateUrl: './shopping-cart.component.html',
styleUrls: ['./shopping-cart.component.scss']
})
export class ShoppingCartComponent implements OnInit {
products: any[];
constructor(public db: AngularFireDatabase){
db.list('/products')
.valueChanges().subscribe(products=>{
this.products=products;
});
}
ngOnInit(): void {
}
}
Maureen MoorePosted Jun 25, 2020, 12:21 PM