How to pass in and return data from a modal?

I think this does what you are looking for.

<div ng-init="sharedData = {value: 22};"></div>
<div>{{sharedData.value}}</div>
<button type="button" class="btn btn-default" ng-click="openModal('demoSharedDataPopup.html', true, 'sm')">
  Open Popup
</button>
<script type="text/ng-template" id="demoSharedDataPopup.html">
  <div class="modal-header">
    <div class="pull-right">
      <button type="button" class="btn btn-default" ng-click="$close()">
        <span class="glyphicon glyphicon-remove"></span> Close
      </button>
    </div>
    <h3 class="modal-title">Demo Popup</h3>
  </div>
  <div class="modal-body">
		<div>{{sharedData.value}}</div>
    <button type="button" class="btn btn-default btn-lg" ng-click="sharedData.value = sharedData.value + 1;">
      <span class="glyphicon glyphicon-chevron-up"></span> Add 1
    </button>
    <button type="button" class="btn btn-default btn-lg" ng-click="sharedData.value = sharedData.value - 1;">
      <span class="glyphicon glyphicon-chevron-down"></span> Subtract 1
    </button>
  </div>
</script>