-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
This is a:
- Bug Report
- Feature Request
- General Query
My version of UI-Router is: 1.0.5
I have tried to seek for help on StackOverflow already but there was no answer. Maybe one of devs that know what was changed will know why $scope.$broadcast()
is not triggering transition hooks.
My post from SO:
I'm trying to migrate to ui-router 1.0.5 and have done most of the work but there are no examples of how to test new transition hooks that replaced $stateChangeXXX events listeners.
Code before:
scope.$on('$stateChangeSuccess', this.hideSpinner_.bind(this));
After:
this.transitions_ is a $transitions service exposed by ui-router this.transitions_.onSuccess({}, this.hideSpinner_.bind(this));
Before I was able to test it by using scope.$broadcast($stateChangeSuccess) and then scope.$apply(). This worked with ui-router 0.x:
expect(ctrl.loading).toBe(true);
expect(ctrl.showLoadingSpinner).toBe(true);
// when
scope.$broadcast('$stateChangeSuccess');
scope.$apply();
// then
expect(ctrl.loading).toBe(false);
expect(ctrl.showLoadingSpinner).toBe(false);
Any idea how to rewrite tests to work with new version of ui-router?
arnoschutijzer