title: Property 'errors' does not exist on type 'ElementRef' Angular 6
body: <p>I have a template driven form with Angular 6. The form's component is nested within a parent component. In the form I have two input fields where I need to raise errors once the component is initiated (errors.required). So I have an event emitter. </p>
  
  <p>I was looking for something similar to ngInit (from AngularJs) so I can call the function that emits the event up to parent component but couldn't find. So instead I need to do it in the component. </p>
  
  <p>So in order to get the input fields in the component, I'm using ViewChild. </p>
  
  <p>So my component looks something like: </p>
  
  <pre><code>@Component({ 
       selector: 'my-form',
       template: ... `&lt;input ... #myInput="ngModel"&gt;` ....
  })
  
  export class myForm implements OnInit, AfterViewInit {
      @ViewChild('myInput') private myInput: ElementRef;
  
   ...
   ...
  
  ngAfterViewInit() {
    console.log(this.myInput.errors);
  </code></pre>
  
  <p>Then when I run the app I get this error:</p>
  
  <p><strong>Property 'errors' does not exist on type 'ElementRef&lt; any ></strong></p>
  
  <p>I tried to do with <code>@ViewChild('myInput', {read: ElementRef})</code> and <code>console.log(this.myInput.nativeElement.errors);</code></p>
  
  <p>Still gets this error message. </p>
  
  <p>Now, if I only console myInput, I'll not get the error message, and in the console I can see the errors key. One thing I noticed, it shows in the console: 
  ngModel { ... ... errors: { ..</p>
  
  <p>So I tried to log also myInput.ngModel.errors - still get the error </p>
  
  <p>Any idea ? </p>
  
  <p>Thanks. </p>