I'm currently working with angular and bootstrap, utilizing the angular-ui-bootstrap bridge library. My goal is to reuse the modal component and encapsulate it within a promise that will be fulfilled upon successful closure of the modal (by clicking the OK
button) or rejected (if the cancel
button is clicked or if the user clicks outside the modal).
From what I've observed, there is the $modal
service from the bridge library, providing only one accessible method: open(options)
. Additionally, there is the native angular promise implementation: $q
. My aim is to find a way to integrate these two components.
I envision creating a custom component (possibly a service or factory) that offers a startFlow
method which returns a promise. Invoking startFlow
would also trigger the opening of the bootstrap modal. Upon closure of the modal (either positively or negatively), the promise would either be resolved or rejected.
Does anyone have any suggestions on how to approach this implementation? I have yet to come across an existing solution...