so here is my modal JS:
function modalInstance() { var ctrlr = function($scope,$uibModalInstance,inName) { var init = function() { $scope.modalTmpStep = { pos: 0, body: '' }; $scope.cancelStep = cancelStep; $scope.submitStep = saveStep; }; function cancelStep() { console.log('closing'); $uibModalInstance.dismiss('dismissed'); } function saveStep() { var submitVar = JSON.stringify($scope.modalTmpStep) console.log('submitting') $uibModalInstance.close(submitVar); } init() }; var modalInstance = $uibModal.open({ animation: true, templateUrl: 'main/add/stepModal/addModal.html', controller: ctrlr, size: 'lg', backdrop: 'static' }); modalInstance.result.then(function() { console.log(); }) }
The ultimate goal of this piece of code is to print the "submitVar" object somewhere on the parent page, the object can be a string or JSON. All variables in questions are processed using the ng model in HTML. I do not know how to pass this value back to the parent controller and you need help.
The console.log ("send") line is currently running, but I donβt know where the submitVar result is located. I plan to use this as an editing window, so the object is transferred, then edited and transferred back, changing the current value.
I use: https://angular-ui.imtqy.com/bootstrap/ as a link and cannot find other documentation on this.
source share