title: how to trigger event click at input type="file" by function in angular 2?
body: <p>I have this code in Html file .</p>
  
  <pre><code>&lt;input #fileInput type="file"  /&gt;
  </code></pre>
  
  <p><strong>demo.ts</strong></p>
  
  <pre><code>import {
    Component,
    Inject,
    OnInit,
    ElementRef,
    Renderer,
    ViewQuery
  } from '@angular/core';
  @Component({
    selector: 'demo',
    templateUrl: 'client/dev/demo/demo.html',
  })
  export class DemoComponent implements OnInit{
  
  @ViewQuery('fileInput') fileInput:ElementRef;
  
  constructor(){}
  
  triggerFile(){
     // do something 
     // trigger input type="file" here
     this.fileInput.nativeElement.click();
  }
  
  ngOnInit() {
  
  
  }
  
  }
  </code></pre>
  
  <p>I see this answer : <a href="https://stackoverflow.com/questions/37320135/how-to-trigger-click-event-of-input-file-from-button-click-in-angular-2">how to trigger click event of input file from button click in angular 2?</a>
  Of course it worked . But I want to trigger input type="file" in triggerFile() function and I use ViewQuery and nativeElement.click() function . but it console this error "Cannot read property 'nativeElement' of undefined" . I use angular2 Rc 1 . thank for help .</p>