dwmkerr / angular-modal-service

Modal service for AngularJS - supports creating popups and modals via a service.
MIT License
626 stars 321 forks source link

On Location Change don't pass event as result #188

Open SergeyCherman opened 7 years ago

SergeyCherman commented 7 years ago

I think when closing the modal on location change it shouldn't pass event as the result .

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 86.154% when pulling 632127854adc2f96396cc780b494de99853ea75e on SergeyCherman:patch-1 into 2c07464da8b661d6721827809f61e1870733bcd6 on dwmkerr:master.

unkillbob commented 7 years ago

I wonder if it would make more sense to reject the close and closed promises in this case? The modal is being closed by an external force (the location change), it feels more like a "cancel" than a successful closing of the modal to me.

SergeyCherman commented 7 years ago

I can see it both ways, however it's possible users of the service have one function for ok/cancel which then uses the function input to decide what to do. In this case if a user has any cleanup logic on modal close it wouldn't run.
Currently reject doesn't fire unless the service isn't being used correct, so it would be a change for service users as they probably don't have logic for the reject case.