Prevent AngularJS modal from closing based on logic inside the modal controller

Is there a way to prevent the an AngularJS modal from closing/dismissing in the controller logic of the modal? What I want is to show a warning when the users closes the modal and the form inside ...