Modal scope?


I open a modal with the following code:

  $scope.openModal = function() {
    $ionicModal.fromTemplateUrl('modal.html', function(modal) {
      $scope.modal = modal;
    }, {
      scope: $scope,
      animation: 'slide-in-up'

And, in my modal, I bind a textarea to ng-model="reply". However, when clicking the “send” button (sending an e-mail), reply doesn’t seem to be anywhere on my $scope. Where are things actually binding to when the modal is open?


This is one of those times when Batarang comes in handy. You can inspect all your scopes this way. You might also find dot notation helpful in this situation. Create an object on your scope called mailOptions with whatever properties you need, then bind ng-model to mailOptions.reply , etc. If you don’t have the scope variable in place, the ng-model is probably bound to a child scope further down.