angularjs弹出框方法二

使用时,首先引入这三个必要的文件
<script src="../angular.js"></script>
<script src="../ui-bootstrap-tpls-0.12.1.js"></script>
<link href="../bootstrap.min.css" rel="stylesheet">
注意,在主模块依赖注入
var routerApp=angular.module('routerApp',['ui.router','ngAnimate','tm.pagination','ui.bootstrap']);
routerApp.controller('takeGoodsSearch',['$scope','$http','$modal','$anchorScroll','$log','$location','$rootScope',function($scope,$http,$modal,$anchorScroll,$log,$location,$rootScope) {
$scope.cancelApply=function(index){
	   $scope.result={};
	   $scope.result.title = "提示消息";
	   $scope.result.msg = "确定要删除?";
	   $rootScope.loanId=index;
	   $modal.open({
			templateUrl : 'tpls/common/reconfirmMessage.html',
			controller :ModalInstanceCtrl,
			resolve : {
				requestResults : function() {
					return $scope.result;
				}
			}
		});	
   }
var ModalInstanceCtrl = function($scope, $modalInstance,requestResults) {
	$scope.results = requestResults;
	// 确认按钮(close()可以带参数)
	$scope.ok = function() {
		$modalInstance.close();
		$http.post('/deletePickup',$rootScope.loanId).success(function(){
			reSearch();
		});
	};
	// 取消按钮
	$scope.cancel = function() {
		$modalInstance.dismiss('cancel');
	};
};
//弹窗结束 
}])

reconfirmMessage.html:
<div class=".modal">
	<div class="modal-header">
		<h3 class="modal-title" data-ng-bind='results.title'></h3>
	</div>
	<div class="modal-body" style="text-align:center">
		 <span data-ng-bind='results.msg'></span>
	</div>
	<div class="modal-footer" style="text-align:center">
		<button class="operation" type="button" data-ng-click="ok()">确认</button>
		<button class="operation" type="button" data-ng-click="cancel()">取消</button>
	</div>
</div>




 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值