title: Angular 4 Error: formGroup expects a FormGroup instance
body: <p>I get the folowing error provided in screenshot. I am creating a LOGIN form in Angular 4.</p>
  
  <p><a href="https://i.stack.imgur.com/KhZF6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KhZF6.png" alt="enter image description here"></a></p>
  
  <p>Here is the current code with the error.</p>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code> import { BrowserModule } from '@angular/platform-browser';
      import { NgModule } from '@angular/core';
      import { ReactiveFormsModule } from '@angular/forms';
  
      import { AppComponent } from './app.component';
      import { ProductComponent } from './product/product.component';
      import { MembersComponent } from './members/members.component';
      import { SortPipe } from './app.sortpipe';
  
      @NgModule({
        declarations: [
        SortPipe,
          AppComponent,
          ProductComponent,
          MembersComponent
        ],
        imports: [
          BrowserModule,
          ReactiveFormsModule
       ],
        providers: [],
        bootstrap: [AppComponent]
      })
      export class AppModule { }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form class="container" [formGroup]="myGroup" (ngSubmit)="onSubmit(myGroup.value)"&gt;
  &lt;input type="text" name="firstName" placeholder="firstName" formControlName="firstName"/&gt;
  &lt;br/&gt;&lt;br/&gt;
  &lt;input type="text" name="lastName" placeholder="lastName" formControlName="lastName"/&gt;
  &lt;br/&gt;&lt;br/&gt;
  &lt;select name="gender" formControlName="gender"&gt;
  &lt;option value="female"&gt;female&lt;/option&gt;
  &lt;option value="male"&gt;male&lt;/option&gt;
  &lt;/select&gt;
  &lt;br/&gt;&lt;br/&gt;
  &lt;input type="submit" value="submit"&gt;
  &lt;/form&gt;
  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
  </code></pre>
  
  <p><strong>app.component.ts</strong></p>
  
  <pre><code>import { Component } from '@angular/core';
  import { FormGroup, FormControl } from '@angular/forms';
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
  
    onSubmit= function (user){
    console.log("user",user);
    }
  
  
    myGroup ;
  
    ngOnInIt(){
     this.myGroup = new FormGroup({
  
    firstName : new FormControl("umair"),
   lastName : new FormControl(""),
    gender  : new FormControl(""),
    })
  
    }
  
  
  }
  </code></pre>
  
  <p>Any help/pointing me in the right direction would be great! Thanks!</p>