Closed MNguyen1515 closed 6 years ago
Hello! I'm pretty sure you need to deregister the transitions once the controller is destroyed to avoid this problem.
var deregisterFn = $transitions.onBefore(...)
$onDestroy() {
deregisterFn()
}
Source: https://github.com/angular-ui/ui-router/issues/2930#issuecomment-241087223
@OlofFredriksson is correct, you need to clean up hooks that are registered inside a controller.
Here is a forked plunker that demonstrates the difference: https://plnkr.co/edit/iEGFqh8DEpJhMA31sni4?p=preview
This issue tracker is for Bug Reports and Feature Requests only.
Please direct requests for help to StackOverflow. See http://bit.ly/UIR-SOF for details.
This is a (check one box):
My version of UI-Router is: (1.0.3)
Bug Report
Current Behavior:
A Transition Hook is being executed multiple times. Plunker example showcasing this provided.
Expected Behavior:
Transition Hook should only execute once. Should be similar to what's to what's on this Plunker: https://plnkr.co/edit/c6ySScGZFhInrhuj0SFK?p=preview Open up the devtools console and click between Hello and About.
Link to Plunker or stackblitz that reproduces the issue:
https://plnkr.co/edit/YaVCJfGEtPOS5JNSLElR?p=preview
Instructions:
Other Notes
Not sure if my implementation is incorrect. Differences between two Plunkers:
Thanks