Search code examples
angularsweetalert2

Angular v6 SwalAlert2 always show a checkbox. I did not put it in there. How can I fix it?


import { default as swal } from 'sweetalert2';

swal({ title: 'Cargando..!', text: 'Espere por favor', allowOutsideClick: false, allowEscapeKey: false,
                allowEnterKey: false, onOpen: () => { swal.showLoading()} });

The image shows a loader and the checkbox that i don't want

The image shows a loader and the checkbox that i don't want


Solution

  • You have 2 options.

    (1) See if sweetalert2 provides an option to hide the checkbox.

    (2) Use CSS to hide the checkbox

    Since components should not manipulate the CSS of their children you should either put your CSS in the global stylesheet - styles.css - OR within the components stylesheet target the checkbox using ::ng-deep (deprecated)

    example:

    styles.css

    .annoying-checkbox {
      display: none;
    }
    

    OR your.component.css

    ::ng-deep .annoying-checkbox {
      display: none; 
    }