Open sime opened 8 years ago
Wouldn't it be more correct to just listen to the $locationChangeStart
event, from the Location service?
@schmuli I can't recall my reasoning, but I feel I recall waiting for $locationChangeStart
to fire in ui-router and it never happening.
Currently if a storage modification is done followed by a route change, it is possible that the changes haven't been committed and thus not available. This PR is the Angular equivalent to the
beforeunload
listener.Rather than making the user manually specify a $timeout() prior to a route change, I think it is of greater convenience to execute
$storage.$apply()
on$routeChangeStart
/$stateChangeStart
.If this may be a undesirable default behaviour, a configuration option can easily be set up.