I have a modal but need to target the closeTo event depending if cancel is pressed or if 'Add To Basket' is pressed. I currently have this
vm.modal = $mdDialog.show({
templateUrl: 'app/views/shop/viewOfferModal.html',
controller: 'viewOfferController',
controllerAs: 'vm',
parent: angular.element(document.body),
closeTo: angular.element(document.querySelector('#basketicon')),
targetEvent: ev,
clickOutsideToClose: false
});
but i cannot seem to change depending on the users action When closing the modal If cancel is pressed I need to close it normally $mdDialog.cancel(); - by the line targetEvent: ev,
But if an action button is pressed(and there is only one button - 'Add to basket') I need the modal to closeTo the basket id.
So I need to use this line somewhere in the modal I'm guessing to change the modal property closeTo: angular.element(document.querySelector('#basketicon')),
Any ideas? Thanks.