来源: angularjs弹出框方法二 – sinat_36146776的博客 – CSDN博客
使用时,首先引入这三个必要的文件
注意,在主模块依赖注入
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: