I'm having rough times trying to close a modal with angularjs.
What I'm doing is open a simple modal when an event is triggered, do something inside the modal and then confirm or abort the operation.
The first opiton goes fine but when I click on the "Abort" button to close the modal the compilator says that close() is not a function.
I thought it was an instance problem so I created one and assigned the open() and close() methods to it but nothing changed...
Here's the JS code:
angular.module("docAcquire.controllers")
.controller('HomeController', ['$scope', '$modal', function ($scope, $modal) {
$scope.modalInstance = $modal;
$scope.openDoc = function() {
$scope.modalInstance = $modal.open({
templateUrl: 'partials/modals/Doc.html',
controller: '',
size : 'lg',
backdrop: 'static',
keyboard: false,
resolve: {}
});
};
$scope.abortOperation = function() {
$scope.modalInstance.close();
};
}
What am I doing wrong?!
EDIT: if you're going to downvote the question at least be man enough to explain why...
$scope.modalInstance = $modal;. - Tushar