facultymatt / angular-unsavedChanges

angular-unsavedChanges
175 stars 81 forks source link

Confirm dialog appears twice #29

Open rmariuzzo opened 9 years ago

rmariuzzo commented 9 years ago

When using Angular UI Router, the angular-unsavedChanges module display the confirm box twice, because two events are being watched: $locationChangeStart and $stateChangeStart.

screenshot from 2014-11-19 21 28 36

Did I'm missing something or is it a bug?

rmariuzzo commented 9 years ago

@facultymatt, looks like I needed to tune up the default configuration: https://github.com/facultymatt/angular-unsavedChanges#routeevent

facultymatt commented 9 years ago

How did you tune it? What is the new config?

smajl commented 9 years ago

Had the same problem. unsavedWarningsConfigProvider.routeEvent = '$stateChangeStart'; in config helped.