How can I make a controller for an $ionicModal


#1

Is it possible to make a controller for an $ionicModal like AngularJS UI Bootstrap $modal ?

here is an example : https://angular-ui.github.io/bootstrap/#/modal

You just have to pass a controller as a callback or pass the controller name as a string


#2

You can check these link.
http://ionicframework.com/docs/api/service/$ionicModal/
http://learn.ionicframework.com/formulas/making-modals/

There are code example with controller too.


#3

Thank you for trying to help, but this is using the parent $scope, it’s not isolated, so it’s using the MainCtrl not an isolated controller for the modal only,


#4

You can use custom controller in:

 <script id="modal.html" type="text/ng-template">
  <ion-modal-view ng-controller="ModalCtrl">

please check for details:
https://github.com/driftyco/ionic/blob/master/test/html/modal.html