title: Close modal window from angular component
body: <p>I need to close my modal window from the angular component, after successfully recording;
  but the code doesn't work for me;
  how can I do?</p>
  
  <pre><code>Angular CLI: 6.0.8
  Node: 10.16.3
  OS: win32 x64
  </code></pre>
  
  <p>--exp.component.html</p>
  
  <pre><code>  &lt;div class="modal fade bd-example-modal-lg" id="modalExperience" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="myExtraLargeModalLabel" aria-hidden="true"&gt;
      &lt;div class="modal-dialog modal-lg"&gt;
        &lt;div class="modal-content"&gt;
  </code></pre>
  
  <p>--exp.component.ts</p>
  
  <pre><code>import { Component, OnInit, Injectable, Inject, ElementRef } from '@angular/core';
  import Swal from 'sweetalert2';
  
  private element: any;
  constructor(
      private el: ElementRef, @Inject('BASE_URL') baseUrl: string
  ) {
      this.url = baseUrl;
      this.element = el.nativeElement;
  }
  Swal.fire({
      title: 'Great',
      html: res.mensaje,
      type: 'success'
  }).then((result) = &gt; {
      if (result.value) {
          //close modal -- it does not work
          this.element.style.display = 'none';
          document.body.classList.remove('modalExperience');
      }
  });
  </code></pre>
  
  <p>With this code all the windows are closed, I see that it affects the selector of the component and the dark shadow of the modal remains.
  Please tell me what is the right way!</p>