the formbuildergroup cannot get data from input in angular8

You have to create the form controls. I would also do a couple things different to be easier to read and maintain.

Is best practice to initiate the form on OnInit instead of the constructor. When a class is instantiated it will first run the constructor and then OnInit.

  ngOnInit() {
     this.initForm();
  }

  initForm() {
     this.checkoutForm = this.formBuilder.group({
         imageURL: new FormControl(this.product.imageURL),
         name: new FormControl(this.product.name),
         category: new FormControl(this.product.category),
         price: new FormControl(this.product.price)
     });
  }

That should do it!

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top