title: Is it possible to submit a form with ViewChild in Angular5?
body: <p>Is it possible to submit a form with ViewChild in Angular5 code? How? <br>
  I tried but it was not successful</p>
  
  <p>HTML :</p>
  
  <pre><code> &lt;form #form="ngForm" (submit)="submitForm(form)" novalidate&gt;
    &lt;input required type="text" #codeRequest="ngModel" [(ngModel)]="requestModel.codeRequest" id="codeRequest" name="codeRequest"/&gt;
   &lt;/form&gt;
  
   &lt;button (click)="func()"&gt; &lt;/button&gt;
  </code></pre>
  
  <p>TypeScript :</p>
  
  <pre><code>@ViewChild('form') form: ElementRef;
    constructor(){}
  
    func(){
      this.formStep2.nativeElement.submit();
    }
  
    submitForm(form: NgForm) {
      ... 
    }
  </code></pre>
  
  <p>Where is my problem؟</p>