Angular 从角度组件关闭模态窗口

Angular 从角度组件关闭模态窗口,angular,sweetalert,Angular,Sweetalert,成功录制后,我需要从角度组件关闭模式窗口; 但是代码对我不起作用; 我该怎么办 Angular CLI: 6.0.8 Node: 10.16.3 OS: win32 x64 --exp.component.html <div class="modal fade bd-example-modal-lg" id="modalExperience" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog

成功录制后,我需要从角度组件关闭模式窗口; 但是代码对我不起作用; 我该怎么办

Angular CLI: 6.0.8
Node: 10.16.3
OS: win32 x64
--exp.component.html

  <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">
    <div class="modal-dialog modal-lg">
      <div class="modal-content">
有了这段代码,所有的窗口都关闭了,我看到它影响了组件的选择器,模态的阴影仍然存在。
请告诉我什么是正确的方法

您需要调用sweetalert弹出窗口的
.close()
方法才能关闭对话框。比如说-

Swal.fire({
          title: 'Great',
          html: res.mensaje,
          type: 'success'
        }).then((result) => {
          if (result.value) {
            Swal.close();    // -->> This should work 
            this.element.style.display = 'none';
            document.body.classList.remove('modalExperience');
          }
        });

我在stackoverflow上的一篇更早的帖子中找到了解决方案;

试着为sweetalert使用angular npm软件包,这与关闭Swal.fire警报无关;我有一个带有“工作经验”列表的第一个窗口和一个打开模式窗口的“添加经验”按钮。在Swal.fire警报中出现录制确认后,在component.ts中,我要关闭模式窗口。是的,我知道了,您可以通过在任何组件中这样做来关闭Swal警报的任何实例,我希望这会清除更多。您好,感谢您的回复,但正如我所说,这与关闭Swal.fire警报无关,警报关闭得很好。这是关于在确认已正确添加或编辑该窗口后,从typescript关闭该窗口。我希望你明白我需要什么。
Swal.fire({
          title: 'Great',
          html: res.mensaje,
          type: 'success'
        }).then((result) => {
          if (result.value) {
            Swal.close();    // -->> This should work 
            this.element.style.display = 'none';
            document.body.classList.remove('modalExperience');
          }
        });