title: Property 'productForm' has no initializer and is not definitely assigned in the constructor
body: <p>I was trying to make a reactive form but this error &quot;Property 'productForm' has no initializer and is not definitely assigned in the constructor.&quot;
  Code for TypeScript file is -</p>
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { FormControl, FormGroup } from '@angular/forms';
  
  @Component({
    selector: 'app-create-product',
    templateUrl: './create-product.component.html',
    styleUrls: ['./create-product.component.css']
  })
  export class CreateProductComponent implements OnInit {
    productForm:FormGroup;
  
    constructor() { }
  
    ngOnInit(){
      this.productForm = new FormGroup({
        name: new FormControl(null),
        email: new FormControl(null),
        number: new FormControl(null),
        address: new FormControl(null) 
      });
    }
  
    onSubmit(){
      console.log(this.productForm)
    }
  }
  
  </code></pre>
  <p>And HTML file for this corresponding file is-</p>
  <pre><code>&lt;form [formGroup]=&quot;productForm&quot; (ngSubmit)=&quot;onSubmit()&quot;&gt;
      &lt;div class=&quot;mb-3&quot;&gt;
          &lt;label class=&quot;form-label&quot;&gt;Name&lt;/label&gt;
          &lt;input type=&quot;name&quot; class=&quot;form-control&quot; formControlName=&quot;name&quot;/&gt;
      &lt;/div&gt;
      &lt;div class=&quot;mb-3&quot;&gt;
        &lt;label  class=&quot;form-label&quot;&gt;Email address&lt;/label&gt;
        &lt;input type=&quot;email&quot; class=&quot;form-control&quot; formControlName=&quot;email&quot; /&gt;
      &lt;/div&gt;
      &lt;div class=&quot;mb-3&quot;&gt;
          &lt;label  class=&quot;form-label&quot;&gt;Mobile Number&lt;/label&gt;
          &lt;input type=&quot;number&quot; class=&quot;form-control&quot; formControlName=&quot;number&quot; /&gt;
        &lt;/div&gt;
        &lt;div class=&quot;mb-3&quot;&gt;
          &lt;label  class=&quot;form-label&quot;&gt;Address&lt;/label&gt;
          &lt;input type=&quot;address&quot; class=&quot;form-control&quot; formControlName=&quot;address&quot; /&gt;
        &lt;/div&gt;
      &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Can anyone tell me what can I do?</p>