Permalink
Browse files

fix(ui-sref-active): Use `$scope.$evalAsync` to apply css class

- Reduce digests caused by removing `$timeout` calls
- This seems to fix the broken behavior reported in both #2503 and #1997

Closes #2503
Closes #1997
Supercedes #2012
  • Loading branch information...
1 parent 27eb5e9 commit 6a9d9ae8784fe9cd98230247744f7bbb8a65479a @christopherthielen christopherthielen committed Nov 5, 2016
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/ng1/directives/stateDirectives.ts
@@ -461,14 +461,11 @@ let uiSrefActive = ['$state', '$stateParams', '$interpolate', '$transitions', '$
}
function addClass(el: IAugmentedJQuery, className: string) {
- el.addClass(className);
- $timeout(function () {
- el.addClass(className);
- });
+ $scope.$evalAsync(() => el.addClass(className));
}
function removeClass(el: IAugmentedJQuery, className: string) {
- el.removeClass(className);
+ $scope.$evalAsync(() => el.removeClass(className));
}
function anyMatch(state: State, params: Obj) {

0 comments on commit 6a9d9ae

Please sign in to comment.