I know there are numerous threads on this issue, but I have tried to follow solutions provided but am having no success.
The one I followed which resolved the error Unknown provider: $uibModalInstanceProvider
, was the answer from @GeorgeKach in Unknown provider: $uibModalInstanceProvider - Bootstrap UI modal. The error has been removed and the modal opens, but my dismissal/close
methods aren't invoking.
vm.open = function() {
console.log('open') //invokes
var modalInstance = $uibModal.open({
templateUrl: 'p3sweb/app/components/app/views/modalTemplate.html',
appendTo: undefined,
controller: function($uibModalInstance ,$scope){
vm.ok = function () {
console.log('ok') //fails
$uibModalInstance.close();
};
vm.cancel = function () {
console.log('close') //fails
$uibModalInstance.dismiss('cancel');
};
}
})
modalInstance.result.then(function() {
//resolved
}, function() {
//rejected
})
}
Question
Why are my ok
and cancel
methods not invoking? Rather than providing a work around, can someone explain why they aren't invoking?
Template
<div class="modal-header d-flex flex-column align-items-center justify-content-center">
<i class="fa fa-warning fa-3x"></i>
<p class="h4 txt-phase-red">Remove Patent</p>
</div>
<div class="modal-body d-flex flex-column align-items-center justify-content-center">
<p class="font-body">Are you sure you want to remove patent application xxxxxxxxxx?</p>
</div>
<div class="modal-footer">
<button class="btn btn--lg font-body font-body--component bg-phase-red txt-white" ng-click="$ctrl.cancel()">No</button>
<button class="btn btn--lg font-body font-body--component bg-phase-green txt-white" ng-click="$ctrl.ok()">Yes</button>
</div>