title: Type 'FormGroup | null' is not assignable to type 'FormGroup'. Type 'null' is not assignable to type 'FormGroup'. Angular 11
body: <p>I am new to Angular, I use version 11.
  And I have a problem with the formGroup attribute in my html file.</p>
  <p>Error :</p>
  <p>'FormGroup | null' is not assignable to type 'FormGroup'.
  Type 'null' is not assignable to type 'FormGroup'.</p>
  <p>2     &lt;form [formGroup]=&quot;produitFormGroup&quot;&gt;</p>
  <p>My html code.</p>
  <pre><code> &lt;form [formGroup]=&quot;produitFormGroup&quot;&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Nom&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; formControlName=&quot;name&quot;&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Prix&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; formControlName=&quot;price&quot;&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Quantite&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; formControlName=&quot;quantity&quot;&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Selected&lt;/label&gt;
          &lt;input type=&quot;checkbox&quot; formControlName=&quot;selected&quot;&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Available&lt;/label&gt;
          &lt;input type=&quot;checkbox&quot; formControlName=&quot;available&quot;&gt;
      &lt;/div&gt;
      &lt;button class=&quot;btn btn-success&quot;&gt;Enregistrer&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>And my ts file code:</p>
  <pre><code>produitFormGroup: FormGroup | null= null;
  
  constructor(private fb: FormBuilder) { }
  
  ngOnInit(): void {
  
     this.produitFormGroup = this.fb.group({
     name:[&quot;&quot;, Validators.required],
     price:[0, Validators.required],
     quantity:[0, Validators.required],
     selected:[true, Validators.required],
     available:[true, Validators.required]
  
   });
  
  }
  
  
    
    
    
    
  </code></pre>