My includes are:
bootstrap.css [ getbootstrap.com/2.3.2 ]
angular/ui-bootstrap-tpls-0.10.0.min.js from: [ angular-ui.github.io/bootstrap ]
I am using AngularJS and Twitter Bootstrap.
From AngularJS I open the modal window as follows:
var modalInstance = $modal.open({
templateUrl: 'resources/html/mymodal.html',
controller: 'mymodalController',
scope: $scope
});
My Modal Template is:
<div class="modal">
<
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
.....
</div>
Question:
The close [x] button is not working
When I click on it, the modal does not go away. But when I press Esc - the modal vanishes.
So looks like ... data-dismiss="modal" is not working. Any ideas?
Cancel button with data-dismiss, no ng-disabled. Send button with ng-disabled, it closes the modal manually in a default onclick.
Click the button to launch the modal. Then click on the backdrop, close icon or close button to close the modal.
Try this code inside you smsAll method: $('#myModal'). modal('hide'); This event is provided by bootstrap, to manually hide a modal.
Open a dialog over the app's content. Press escape or click outside to close the dialog and send focus back to the triggering button.
the data-dismiss
attribute is used by the bootstrap javascript (as I see you got the html source code from, http://getbootstrap.com/javascript/#modals )
UI Bootstrap won't be binding to that close button because it isn't looking for that attribute, you need to add an ng-click and dismiss the modal like in the examples
http://angular-ui.github.io/bootstrap/#/modal
in controller:
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
Modal template...
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
In angular, there is a close
method of $modalInstance
to close a opened modal window .
Controller :
$scope.closeMyPopup = function () {
$modalInstance.close();
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With