angularjs - Not able to get the updated value from modal back to controller -
i have modal , doing process update value modal , not updating controller. please let me know how value($scope.currentitem.value) modal controller.
$scope.showmodalform = function(data, index) { $scope.currentitem = data; ngdialog.open( { template: '/scripts/app/panel/myinfo.html', controller: 'myinfocontroller', scope: $scope, width:"50%", }) }; angular.module('app') .controller('myinfocontroller', function ($scope,$http, $log) { $scope.submit = function() { // open modal , process sucessfully need send approve controller if(process) { $scope.currentitem.value = "corrected"; } if(!process) { $scope.currentitem.value = "wrong"; } } }
according ngdialog docs:
scope object passed dialog. if use controller separate $scope service object passed $scope.$parent param
so, in myinfocontroller need reference $scope of parent controller $scope.$parent instead of $scope. this:
$scope.$parent.currentitem.value = "corrected";
here's working plunk
Comments
Post a Comment