title: Pass Angular modal data to main controller
body: <p>I have a controller inside which i am using a modal. Please check this</p>
  
  <pre><code>'use strict'
  var DataMod = angular.module('Data', ["angularGrid", 'ui.bootstrap.contextMenu', 'ui.bootstrap']);
  DataMod.controller('DataController', ['$scope', '$compile', '$uibModal', '$log','$rootScope', '$http', function ($scope, $compile, $uibModal,$log, $rootScope, $http, ngUtilityService) {
  
  
  $scope.adduser = function () {
  
  
      var modalInstance = $uibModal.open({
          templateUrl: 'myModalContent.html',
          controller: ModalInstanceCtrl
      });
  
  };
  
  //use data value here. 
  
  
  
  var ModalInstanceCtrl = function ($scope, $uibModalInstance) {
  
      var data = "analog";
  
      $scope.cancel = function () {
          $uibModalInstance.dismiss('cancel');
      };
  };
  
  
  }
  
  ]);
  </code></pre>
  
  <p>As you can see, the user clicks on 'Add user' tab. the add user function gets executed and a modal pops up. There are several internal processing which i have done. </p>
  
  <p>At the end, i want to transfer one variable 'data' back to the main controller. Can someone please let me a simple example of how to transfer data from modal to controller. </p>
  
  <p>I have seen several examples and understood resolve will help me achieve it. But i am confused on it totally...</p>