UNPKG

thalassa-aqueduct

Version:

Dynamic haproxy load balancer and configuration. Part of Thalassa

51 lines (44 loc) 1.45 kB
function DialogDemoCtrl($scope, $dialog){ // Inlined template for demo var t = '<div class="modal-header">'+ '<h3>This is the title</h3>'+ '</div>'+ '<div class="modal-body">'+ '<p>Enter a value to pass to <code>close</code> as the result: <input ng-model="result" /></p>'+ '</div>'+ '<div class="modal-footer">'+ '<button ng-click="close(result)" class="btn btn-primary" >Close</button>'+ '</div>'; $scope.opts = { backdrop: true, keyboard: true, backdropClick: true, template: t, // OR: templateUrl: 'path/to/view.html', controller: 'TestDialogController' }; $scope.openDialog = function(){ var d = $dialog.dialog($scope.opts); d.open().then(function(result){ if(result) { alert('dialog closed with result: ' + result); } }); }; $scope.openMessageBox = function(){ var title = 'This is a message box'; var msg = 'This is the content of the message box'; var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}]; $dialog.messageBox(title, msg, btns) .open() .then(function(result){ alert('dialog closed with result: ' + result); }); }; } // the dialog is injected in the specified controller function TestDialogController($scope, dialog){ $scope.close = function(result){ dialog.close(result); }; }