lakshman_dev lakshman_dev - 6 months ago 115
AngularJS Question

How can params be passed through Ionic Modal?

Like we pass params through modal, as did in below by

resolve
example :

$scope.someFunction = function(item) {
item.root = true;
modalInstance = $uibModal.open({
animation: true,
controller: 'newController',
templateUrl: '/views/modals/somePage.html',
resolve: {
params: function () {
return { item: item};
}
}
});
};


I am not sure how to pass params in ionicModal ??

$ionicModal.fromTemplateUrl('main/templates/viewPage.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});


Is there an option along with
animation
as in above ionicModal code?

Help is much appreciated!

Answer

You do not need to pass any data. Your parent scope is already passed as

scope : $scope

So you can take your data as scope.item.

Please follow this URL https://forum.ionicframework.com/t/how-to-pass-data-from-parent-controller-to-ionicmodal/2030/2

Comments