if your modal has a cancel button (Otherwise create a hidden close button). You can simulate the click event on this button so that your form is closed. Iin your component add a ViewChild
export class HelloComponent implements OnInit {
@ViewChild('fileInput') fileInput:ElementRef;
in your close button add #fileInput
<button class="btn btn-danger" #fileInput id="delete-node" name="button" data-dismiss="modal" type="submit">Cancelar</button>
When you want to close the modal programmatically trigger an click event on the close button
this.fileInput.nativeElement.click();