i have service for modal invoking as shown.
.service('modalService', ['$modal', function ($modal) {
var modalDefaults = {
backdrop: 'static',
keyboard: true,
modalFade: true
};
this.showModal = function (template) {
modalDefaults.template = template;
modalDefaults.controller = 'modalController';
return $modal.open(modalDefaults).result;
};
}])
.controller('modalController', function ($scope, $modalInstance) {
console.log('modalController');
$scope.ok = function () {
$modalInstance.close('okResult');
};
$scope.cancel = function (result) {
$modalInstance.dismiss('cancel');
};
})
I invoke this modal from a controller say 'controllerA'. The template used for modal contains custom drectives. I need to get the modal controller functionalities like $modalInstance.dismiss and $modalInstance.close in the controller of the custom directive controller of the template, say 'controllerB'.
My template is like this:
<custom-form></custom-form>