title: Accessing a component from global error handler in angular
body: <p>I have created an error handler in angular and i would like to access a modal component (which is registered in appmodule) and show the error in it. I am new to angular so i couldn`t figure out how to access it. Any help would be appreciated. 
  Error Handler</p>
  
  <pre><code>export class GlobalErrorHandler implements ErrorHandler{
  
      handleError(error){
  
          alert(error);
          console.log("handeled by GlobalErrorHandler")
          console.log("error",error);
          console.log("******************");
  
          //instead of logging to the console, i would like to call globalModal component and show the error in a popup
      }
  
  }
  </code></pre>
  
  <p>Global modal html</p>
  
  <pre><code>&lt;div bsModal #globalModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-dialog modal-success" role="document"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;h4 class="modal-title"&gt;{{_modalTitle|translate}}&lt;/h4&gt;
          &lt;button type="button" class="close" (click)="globalModal.hide()" aria-label="Close"&gt;
            &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
          &lt;/button&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;p&gt;{{_modalBody|translate}}&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-primary" (click)="globalModal.hide()"&gt;Kapat&lt;/button&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;&lt;!-- /.modal-content --&gt;
    &lt;/div&gt;&lt;!-- /.modal-dialog --&gt;
  &lt;/div&gt;&lt;!-- /.modal --&gt;
  </code></pre>
  
  <p>global modal ts</p>
  
  <pre><code>@Component({
    selector:'GlobalModal',
    templateUrl: 'globalModal.component.html'
  })
  
  
  
      export class GlobalModalComponent {
          @ViewChild('globalModal') globalModalElement:ModalDirective
           _modalTitle:string;
           _modalBody:string;
  
          show(modalTitle,modalBody){
            this._modalTitle = modalTitle;
            this._modalBody = modalBody;
            this.globalModalElement.show();
          }
  
       }
  </code></pre>