I’ve got a modal:
$ionicModal.fromTemplateUrl('products_modal.html', {
scope: $scope,
animation: 'slide-in-up',
focusFirstInput: false,
backdropClickToClose: true,
hardwareBackButtonClose: true
}).then(function(products) {
$scope.products = products;
});
I need to react on the modal close from backdrop or device back button and do something when it happens. I’ve seen in the docs that some events are fired, but I cannot catch them. Here is my code:
$scope.$on('products.hidden', function() {
console.log('onModalClose catched!');
doSomethingOnModalClose();
});
Unfortunately this doesn’t work for me and the console output never happens.
The above code is inspired by http://ionicframework.com/docs/api/service/$ionicModal/
Could you please point me to a correct solution? TIA.
Cheers,
Rafal