ui-bootstrap 中模态

官网 angular-ui-bootstrap   对于ui-bootstrap集成大量指令如折叠ui.bootstrap.accordion、时间插件ui.bootstrap.datepicker、接下来要说明的模态窗ui.bootstrap.modal等.....

疑问? angular-ui-bootstrap-1.3.2 引入时遇到问题:

Error: [$injector:unpr] Unknown provider: $templateRequestProvider <- $templateRequest <- $uibModal

解决  angular-1.5.5 问题得以解决

官网案列——模态效果

ui-bootstrap-modal在线编辑代码 请猛点击这里

ui-bootstrap-modal实现Demo[折叠]如下

<!DOCTYPE html>
<html ng-app="ui.bootstrap.demo">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ui.bootstrap 模态窗</title>
<link rel="stylesheet" href="framework/bootstrap-3.0.0/css/bootstrap.min.css" />
<script type="text/javascript" src="framework/angular-1.5.5/angular.js"></script>
<script src="framework/angular-ui-bootstrap-1.3.2/ui-bootstrap-tpls.min.js"></script>
</head>
<body ng-controller="ModalDemoCtrl">
<div style="padding: 20px;">
<button type="button" class="btn btn-primary" ng-click="open()">Open me!</button>
<button type="button" class="btn btn-success" ng-click="open('lg')">Large modal</button>
<button type="button" class="btn btn-default" ng-click="open('sm')">Small modal</button>
<div ng-show="selected">Selection from a modal: {{ selected }}</div>
</div>
<script type="text/javascript">
var myModal = angular.module('ui.bootstrap.demo', ['ui.bootstrap']);
myModal.controller('ModalDemoCtrl', function ($scope, $uibModal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size) {
var modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl', /*依赖控制器注入*/
backdrop: "static",
size: size,
resolve: { /*传递到模态窗口中的对象*/
items1: function () {
return $scope.items;
}
}
});
//模态实例---ModalDemoCtrl中的$scope
//接收点击ok参数
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
}; $scope.toggleAnimation = function () {
$scope.animationsEnabled = !$scope.animationsEnabled;
};
}); //$uibModalInstance是模态窗口的实例
myModal.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, items1) {
$scope.items = items1;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
//$scope.selected.item 值传到
$uibModalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
});
</script> <script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3 class="modal-title">I'm a modal!</h3>
</div>
<div class="modal-body">
<ul>
<li ng-repeat="item in items">
<a href="#" ng-click="$event.preventDefault(); selected.item = item">{{ item }}</a>
</li>
</ul>
Selected: <b>{{ selected.item }}</b>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">OK</button>
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
</script>
</body>
</html>

ngDialog 轻量级弹窗

官网 ng-dialog

<!DOCTYPE html>
<html lang="en" ng-app="indexApp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--引入第三方样式库bootstrap.min.css-->
<link rel="stylesheet" href="framework/bootstrap-3.0.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="framework/ngDialog-0.6.4/css/ngDialog.css">
<link rel="stylesheet" href="framework/ngDialog-0.6.4/css/ngDialog-theme-default.css"> <link rel="stylesheet" href="css/main.css" />
<!--引入js库anglarjs-->
<script type="text/javascript" src="framework/1.3.0.14/angular.js"></script>
<script type="text/javascript" src="framework/ngDialog-0.6.4/js/ngDialog.js"></script>
</head>
<body ng-controller="indexCtrl">
<button class="btn btn-primary" ng-click="clickToOpen()">弹窗</button>
<script>
var myModal = angular.module('indexApp',['ngDialog']);
myModal.controller('indexCtrl',function($scope,ngDialog, $http){ $http.get('cardInfo/cardInfo.json').success(function(data) {
$scope.cardInfo = data;
}); $scope.clickToOpen = function () {
ngDialog.open({
template: 'templateId.html',
className:'ngdialog-theme-default ngdialog-theme-plain',
scope: $scope,
width: '60%',
controller:function($scope){
$scope.show = function(){
$scope.closeThisDialog(); //关闭弹窗
}
}
});
};
})
</script> <script type="text/ng-template" id="templateId.html">
<div class="ui-dialog-title ">卡片详情信息</div>
<div class="ui-dialog-content">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>场所名称</th>
<th>门名称</th>
<th>员工姓名</th>
<th>员工电话</th>
<th>卡号</th>
<th>开卡日期</th>
<th>部门名称</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cardInfos in cardInfo">
<td>{{cardInfos.place}}</td>
<td>{{cardInfos.doorName}}</td>
<td>{{cardInfos.name}}</td>
<td>{{cardInfos.phoneNumber}}</td>
<td>{{cardInfos.cardNumber}}</td>
<td>{{cardInfos.carDate | date: 'yyyy-MM-dd' }}</td>
<td>{{cardInfos.department}}</td>
</tr>
</tbody>
</table>
<button type="submit" class="btn btn-primary" ng-click="show()">保存</button>
<button type="button" class="btn btn-default" ng-click="closeThisDialog()">取消 </button>
</div>
</script>
</body>
</html>

Angular之模态弹窗ui-bootstrap-modal及轻量级弹窗ngDialog的更多相关文章

  1. bootstrap Modal或者 bootbox弹窗时,页面混动至顶部

    bootstrap使用Modal时,页面自动滚动至了最顶部, 调用bootbox时,也是如此 查了半天资料,最后参考下述帖子,解决问题 https://stackoverflow.com/questi ...

  2. Angular -ui - BootStrap组件的解释以及使用

    关于UI BootStrap UI BootStrap 是angularUI团队用纯粹angularJS语法编写的Bootstrap组件. 1. 关于ng-router(angular-router. ...

  3. Bootstrap modal模态框关闭时,combobox input下拉框仍然保留在页面上

    问题描述: 当点击模态框的关闭按钮时,下拉框中的内容没有消失,而是移动到了页面左上角 分析:这个问题的定位在于是用的哪种模态框,bootstrap和easyui都可以实现模态框,但是两个方法实现的模态 ...

  4. 重置 Bootstrap modal 模态框数据

    利用 Bootstrap modal 模态框弹层添加或编辑数据,第二次弹出模态框时总是记住上一次的数据值,stackoverflow 上找到个比较好的方法,就是利用 jQuery 的 clone 方法 ...

  5. 对bootstrap modal的简单扩展封装

    对bootstrap modal的简单扩展封装 参考自:http://www.muzilei.com/archives/677   注:原文不支持bootstrap新版本,并且居中等存在问题 此段时间 ...

  6. Bootstrap modal.js 源码分析

    /* ======================================================================== * Bootstrap: modal.js v3 ...

  7. iOS开发UI篇—Modal简单介绍

    iOS开发UI篇—Modal简单介绍 一.简单介绍 除了push之外,还有另外一种控制器的切换方式,那就是Modal 任何控制器都能通过Modal的形式展⽰出来 Modal的默认效果:新控制器从屏幕的 ...

  8. Bootstrap modal常用参数、方法和事件

    Bootstrap modal(模态窗)常用参数.方法和事件: 参数: 名称 类型 默认值 描述 Backdrop Boolean或字符串“static” True True:有背景,点击modal外 ...

  9. bootstrap modal 监听滚动条事件

    bootstrap modal 里面使用datetimepicker时间控件,滚动时,时间控件并不会隐藏,这是一个小bug,在组里改下,当滚动条滚动时,直接隐藏这个时间控件,$("#alar ...

随机推荐

  1. C# 插入条码到Excel指定单元格

    .NET中Barcode Library的应用二 介绍 在上一篇中我已经简单介绍了这个函数库(条形码应用之一------------函数库的简介).在这一篇中我将使用这个库提供更多的操作,希望对大家有 ...

  2. mybatis_06SQL片段

    个人概要: SQL片段在使用if where的基础上,将if,where语句装到SQL标签内,在数据库操作元素内引用 Mybatis提供了SQL片段的功能,可以提高SQL的可重用性. <!--声 ...

  3. 4.7 explain 之 Extra

    一.说明 包含不合适在其他列中显示,但十分重要的信息. 二.分类 a. Using filesort : 说明mysql 会对数据使用一个外部的索引排序,而不是按照表内的索引顺序排序进行读取的.mys ...

  4. java安全管理器SecurityManager介绍

    java安全管理器类SecurityManager简单剖析: javadoc介绍: SecurityManager是一个允许应用实现一种安全策略的类.它允许一个应用去明确,在执行一个可能安全或者敏感的 ...

  5. CentOS 7.0 下 Python 2.7 升级到 Python 3.5

    前段因为时间工作需要,要把 Centos 7.0 默认安装的 Python 2.7 升级到 Python 3.5. 具体操作如下: # 安装 gcc gcc-c++ 等编译工具软件 yum insta ...

  6. 【20190221】HTTP-URI与URL

    URI(uniform resource identifier)统一资源标识符是由某个协议方案表示的资源的定位标识符, URI 用字符串标识某一互联网资源,而 URL 表示资源的地点(互联网上所处的位 ...

  7. 【代码笔记】Web-JavaScript-JavaScript表单验证

    一,效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  8. 从换脸到换姿势,AI 在图像处理的道路上越走越魔幻

    从换脸到换姿势,AI 在图像处理的道路上越走越魔幻 https://mp.weixin.qq.com/s/VFq3BWLpzyKZ3sqVWf1HKA [导读]加州大学伯克利分校的研究人员,近日在著名 ...

  9. iPhone X手机投屏电脑无线连接教程

    iPhone X手机是一款非常有气场的手机,独特的设计,展现手机的独特魅力,手机外观让人一眼就爱上,手感也是超级的舒适,真的是堪称完美,但是iPhone X手机投屏电脑怎么无线连接呢? 使用工具: 电 ...

  10. writing objects : 值%停住

    在git bush 中使用命令:git config --global http.postBuffer 524288000 因为git上传,限定一次push命令的buffer大小.