Open modal view with specific modal controller


#1

Hi,

My application is tab based application, where user can checkout the item from cart. My requirement is to open a modal view when user tap on Order Now button.

I created template with ion-modal-view and also defined the ng-controller in template.

I tried to to load the modal controller using following code snippet:

$ionicModal.fromTemplateUrl(‘templates/cart.html’,{
scope:$scope,
animation:‘slide-in-up’,
controller:‘CartCtrl’
}).then(function(modal) {
$scope.modal = modal;
});

OnButtonClick = function(){
$scope.modal.show();
}

I am able to show the modal controller with slide-in-up animation but the controller is not getting fired.

Issue:
Modal View Controller is not getting fired due with which view is empty.

Please help.

@iondev @ionicteam


#2

you can only pass this list of options:
http://ionicframework.com/docs/api/controller/ionicModal/#initialize

if you want a controller to the modal --> add the controller in the modal-template over ngController direktive.