<!doctype html>
<html ng-app="home">
<head>
<link rel="stylesheet" href="lib/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" >
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.0.1/ui-bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.0.1/ui-bootstrap-tpls.js"></script>
<script src="lib/script.js"></script>
</head>
<body ng-controller="ModalController">
<h1>Hello Plunker!</h1>
<button ng-click="showSomeModal()">Modal 1</button>
<button ng-click="showOtherModal()">Modal 2</button>
</body>
</html>
/* Add your styles here */
angular.module('home', ['ui.bootstrap'])
.controller('ModalController',function($scope,$uibModal){
function openModal(ok, cancel) {
$uibModal.open({
animation: true,
templateUrl: 'modal.html',
size: 'sm',
backdrop: 'static',
keyboard: false,
controller: function($scope) {
$scope.ok = function() {
$scope.$close();
ok();
};
$scope.cancel = function() {
$scope.$dismiss();
cancel();
};
}
});
}
angular.extend($scope, {
modalTitle: 'I am a Title',
modalContent: 'I am model content',
showSomeModal: function() {
openModal(angular.noop, angular.noop);
},
showOtherModal: function() {
function ok() {
console.log('ok');
}
function cancel() {
console.log('cancel');
}
openModal(ok, cancel);
}
});
});
<div ng-controller="ModalController">
<div class="modelstitle">
<div class="modal-header mdlheader">
<button type="button" class="close close-btn" ng-click="cancel()">×</button>
<h3 class="modal-title mdltitle" ng-model="modalTitle">{{modalTitle}}</h3>
</div>
<div class="modal-body mdlbody">
<p ng-model="modalContent">{{modalContent}}</p><br/>
</div>
<div class="modal-footer footerbtn">
<button class="btn btn-primary btnwarning" type="button" ng-click="cancel()">Cancel</button>
<button class="btn btn-primary btnwarning" type="button" ng-click="ok()">OK</button>
</div>
</div>
</div>
Angular UI Bootsrap modal callback
http://stackoverflow.com/q/38878732/1061668