How to pass in and return data from a modal?

Hi all,

I found out there is no way to do this without using a javascript controller but cant figure out how to do it successfully.

the controller data seems to be isolated to either the main widget ot the modal but i cant get it to cross from one to the other.

Can someone provide a bare bones example of pressing a button to set a value and pop up a modal, then the modal displays the value and has a button to return a different value?

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>

Perfect that was exactly what I was looking for, thanks for the write up @jjones!