Skip to content

Instantly share code, notes, and snippets.

@joshwentz
Last active January 3, 2016 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshwentz/8410572 to your computer and use it in GitHub Desktop.
Save joshwentz/8410572 to your computer and use it in GitHub Desktop.
Popup Modal for Bootstrap/Angular. More at http://joshwentz.blogspot.com/2014/01/pop-up-box-modal-with-angular.html. Demo at virtualpulse.us/EWEB/modal.html
<html ng-app="modal">
<head>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.7.0.js"></script>
<script>
angular.module('modal', ['ui.bootstrap']);
var ModalDemoCtrl = function($scope, $modal, $log) {
$scope.open = function() {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
});
};
};
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
</script>
</head>
<div ng-controller="ModalDemoCtrl">
<script type="text/ng-template" id="myModalContent.html">
<div class = "modal" style="width:600px;">
<div class = "modal-body" style="max-height:480px;">
Popup Modal Content
</div>
</div>
</script>
<a href="" ng-click="open()">Open Popup</a>
</div>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment