Skip to content

Commit 3a8c2ff

Browse files
Add a timeout when updating vertical nav on window resize event
This reduces/eliminates the number of times a $apply already in progress exception is thrown. Although the exception is caught, some applications still detect the exception and log to the console.
1 parent 4199b06 commit 3a8c2ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/navigation/vertical-navigation-directive.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,13 @@
11021102

11031103
angular.element($window).bind('resize', function () {
11041104
checkNavState();
1105-
try {
1106-
$scope.$apply();
1107-
} catch (e) {
1108-
// Ignore, if we already applied, that is fine.
1109-
}
1105+
$timeout(function () {
1106+
try {
1107+
$scope.$apply();
1108+
} catch (e) {
1109+
// Ignore, if we already applied, that is fine.
1110+
}
1111+
});
11101112
});
11111113
}
11121114
};

0 commit comments

Comments
 (0)