I do not want to use angular2-bootstrap or ng2-bs3-modal as suggested in the questions/answers Angular 2 Bootstrap Modal and Angular 2.0 and Modal Dialog
Now. I kno
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
When you want to close the modal programmatically trigger an click event on the close button
this.fileInput.nativeElement.click();
To open you can use the same idea