$ionicModal unable to add items to scope


#1

I am trying to use $ionicModal, but I am unable to add the created model into the $scope through the callback. See the code below:

$ionicModal.fromTemplateUrl('my-template.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) { //modal successful... create management functions
$scope.modal = modal;
``
//Cleanup the modal when we're done with it!
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
}, function(err) {
console.log('error in modal', err);
}, function(notify) {
console.log('notificatin: ', notify);
});

However, when I call modal.show() in the template, I get an error Uncaught ReferenceError: modal is not defined. I am guessing the modal value is being added to the child scope in the modal but not in the parent scope in the original controller.