From 4fa878b580fd9799d80931a8ccc14856ec640bc4 Mon Sep 17 00:00:00 2001 From: Torgeir Thoresen Date: Sat, 11 May 2013 17:13:48 +0300 Subject: [PATCH] Delay $anchorScroll() to handle `autoscroll` for nested ng-includes. This resolves an issue where the contents of an `ng-include` also contain an ng-include with autoscroll, like this `
`. In issue #2637 the element to scroll to by using `#some-anchor-name` in the url, e.g. ``, is not present in the dom by the time `$anchorScroll()` is called from the ngIncludeDirective. --- src/ng/directive/ngInclude.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index 1187c7338748..87b1f983d80e 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -172,7 +172,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' $compile(contents)(childScope); if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { - $anchorScroll(); + scope.$evalAsync($anchorScroll); } childScope.$emit('$includeContentLoaded');