I have these two views:
1) foo.html
Hello {{name}}
2) foo-as-modal.html
Well I solved this way:
$uibModalInstance from fooControllerWhen invoking the modal, I pass the modalInstance as a variable to the modal's scope:
var modalScope = $scope.$new();
var modalInstance = $uibModal.open({
templateUrl: 'foo-as-modal.html',
controller: 'fooController',
scope: modalScope
});
modalScope.modalInstance = modalInstance;
Dismiss the modal with the scope variable:
$scope.modalInstance.dismiss('cancel'); // instead of $uibModalInstance.dismiss(..)
Here is a fork of the original plunkr, with this solution: https://plnkr.co/edit/ZasHQhl6M5cCc9yaZTd5