In order to open a modal, we need to inject a component called a service into our controller. In this case, Bootstrap UI provides a service called $uibModal.
This service provides functions for modals
We can call $uibModal.open to open a new modal instance with parameters. We have to specify the location of the template and the controller used for the modal instance
The controller ModalInstanceCtrl provides a controller specifically for a modal instance. The $scope in this controller is separate from the scope of the controller that called it.
$uibModalInstance represents the modal instance, and we can call functions like dismiss and close in order to perform operations on the instance.
Passing Data between Controllers
We may have an instance where data needs to be passed from the main controller to the modal instance controller. In that case, the Bootstrap UI modal service provides some functionality to pass data back and forth.
Including a resolve object to the modal instance serves as a "gateway" for passing data to the modal controller
Once data is passed into the object, it can be accessed by including it as a dependency in the controller
Attach the data from the dependency to the controller's $scope
Data can be passed back to the main controller by passing it as an argument to the $uibModalInstance.close function
Once the data is passed, it can be accessed in the main controller through result, a promise.