How to pass data from parent controller to ionicModal?

You can’t do that here because Modals are not routes or states in Ionic. However, you can give the modal access the original controller’s scope by passing in the scope parameter:

        $ionicModal.fromTemplateUrl('modal.html', function(modal) {
          $scope.modalCtrl = modal;
        }, {
          scope: $scope,  /// GIVE THE MODAL ACCESS TO PARENT SCOPE
          animation: 'slide-in-left',//'slide-left-right', 'slide-in-up', 'slide-right-left'
          focusFirstInput: true
        });

See sample : http://codepen.io/calendee/pen/LhJsK

5 Likes