Closed
Description
Hi,
I've created a Plunker here
As shown in the example I think one would expect to be able to use event.preventDefault()
in the $stateChangeStart
event to prevent a transition, then later trigger that same transition manually with {notify: false}
to prevent the event being triggered and therefore the state transition being blocked again (infinite loop).
However the viewDirective
is relying on $stateChangeSuccess
internally which is also prevented by {notify: false}
.
One work around is like so:
$state.go(toState.name, toParams, {notify: false}).then(function() {
$rootScope.$broadcast('$stateChangeSuccess', toState, toParams, fromState, fromParams);
});
I think perhaps the best solution here would be to use an alternative event internally to trigger the updateView()
in viewDirective
, or alternatively extend notify
to target start/success events separately.
Thanks