弹出样式:
样式:
pre-exam-index.html
pre-exam-index.html 对应的js
//既往史按钮点击弹出弹框,$scope.openHistory=function(){ angular.element('#preHistoryDiv').scope().openHis();};
pre-exam-history-template.html
既往史
pre-exam-history-template.html 对应的js
$scope.openHis=function(){ $scope.previousHistoryModalFlag=true;};
橙色标注的angular指令
hr-draggable
/** *使元素可拖动 */angular.module('hr.directives').directive('hrDraggable', ['$parse', function ($parse) { return { restrict: 'A', link: function (scope, element, attr) { if (attr["modal"] !== undefined) { scope.$watch(attr["modal"], function (newValue) { if (newValue) { setTimeout(function () { $(".modal").draggable({handle: ".modal-header"}); }, 100); } else { $(".modal").attr("style", ""); } }, true); $(window).resize(function () { $(".modal").attr("style", ""); }); } else { element.draggable($parse(attr["hrDraggable"])(scope)); } } };}]);
model <--ui-bootstrap-tpls.js
angular.module('ui.bootstrap.modal', ['ui.bootstrap.dialog']) .directive('modal', ['$parse', '$dialog', function($parse, $dialog) { return { restrict: 'EA', terminal: true, link: function(scope, elm, attrs) { var opts = angular.extend({}, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options)); var shownExpr = attrs.modal || attrs.show; var setClosed; // Create a dialog with the template as the contents of the directive // Add the current scope as the resolve in order to make the directive scope as a dialog controller scope opts = angular.extend(opts, { template: elm.html(), resolve: { $scope: function() { return scope; } } }); var dialog = $dialog.dialog(opts); elm.remove(); if (attrs.close) { setClosed = function() { $parse(attrs.close)(scope); }; } else { setClosed = function() { if (angular.isFunction($parse(shownExpr).assign)) { $parse(shownExpr).assign(scope, false); } }; } scope.$watch(shownExpr, function(isShown, oldShown) { if (isShown) { dialog.open().then(function(){ setClosed(); }); } else { //Make sure it is not opened if (dialog.isOpen()){ dialog.close(); } } }); } }; }]);