javascript - 點(diǎn)擊select框選項(xiàng) 彈出ngDialog 點(diǎn)擊取消的時(shí)候 關(guān)閉彈出框 希望select框的值不變
問(wèn)題描述
標(biāo)題文字 ##下邊是我的代碼,點(diǎn)擊取消后,select框的值依然會(huì)改變//views< select ng-model='nextparam.emscaapportionh.imp_erp_type' ng-options='m.itemValue as m.itemName for m in impErpTypes' ng-disabled='!isErpTypeEdit' ng-change='impErpTypeChange()' > </select >
//ngDialogCtrl(function () { ’use strict’; angular.module(’app’).controller('ngDialogCtrl', [’$scope’, function ($scope) {$scope.msg = $scope.dialog ? $scope.dialog.msg : ’確認(rèn)要執(zhí)行嗎?’; }]);})();
//業(yè)務(wù)邏輯$scope.openConfirmDialog = function (callback, msg) {$scope.dialog = {msg: msg }; ngDialog.openConfirm({template: ’app/app_common/views/ngdialog.confirm.html’,plain: false,showClose: true,closeByDocument: true,closeByEscape: true,scope: $scope,width: ’20%’,controller: ’ngDialogCtrl’ }).then(callback);}; //修改導(dǎo)ERP類(lèi)型$scope.impErpTypeChange = function () { var impErpTypeChangeFun = function () {$scope.budgetGridOptions.data = []; }; $scope.openConfirmDialog(impErpTypeChangeFun, ’更改導(dǎo)類(lèi)型將會(huì)清空明細(xì),是否繼續(xù)?’);}
問(wèn)題解答
回答1:看了ngDialog api,加多一個(gè)preCloseCallback屬性即可
$scope.openConfirmDialog = function (callback, closeCallback ,msg) { $scope.dialog = {msg: msg }; ngDialog.openConfirm({template: ’app/app_common/views/ngdialog.confirm.html’,plain: false,showClose: true,closeByDocument: true,closeByEscape: true,scope: $scope,width: ’20%’,controller: ’ngDialogCtrl’,preCloseCallback:closeCallback, }).then(callback);}//修改導(dǎo)ERP類(lèi)型$scope.oldImpErpType = $scope.nextparam.emscaapportionh.imp_erp_type;$scope.impErpTypeChange = function(){ var impErpTypeChangeFun = function () { $scope.$emit('changeImpErpType'); }; var closeFun = function(){$scope.nextparam.emscaapportionh.imp_erp_type = $scope.oldImpErpType; } $scope.openConfirmDialog(impErpTypeChangeFun, closeFun,’更改導(dǎo)ERP類(lèi)型將會(huì)清空預(yù)提明細(xì),是否繼續(xù)?’);}
相關(guān)文章:
1. javascript - 移動(dòng)端自適應(yīng)2. html5 - java用commons-fileupload上傳文件沒(méi)效果!3. android下css3動(dòng)畫(huà)非常卡,GPU也不差啊4. 關(guān)于docker下的nginx壓力測(cè)試5. docker-machine添加一個(gè)已有的docker主機(jī)問(wèn)題6. docker鏡像push報(bào)錯(cuò)7. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.8. angular.js - angular內(nèi)容過(guò)長(zhǎng)展開(kāi)收起效果9. 為什么我ping不通我的docker容器呢???10. nignx - docker內(nèi)nginx 80端口被占用
