diff options
| author | Pete Bacon Darwin | 2013-11-02 09:22:26 +0000 | 
|---|---|---|
| committer | Jeff Cross | 2013-11-06 00:14:11 -0800 | 
| commit | d378f5500ab2eef0779338336c6a95656505ebb8 (patch) | |
| tree | b824ce7a50df0427cc86fb2d50813e47e76f73ac /src | |
| parent | 9470080762aecca5285d0f5cac4ae01540bbad4c (diff) | |
| download | angular.js-d378f5500ab2eef0779338336c6a95656505ebb8.tar.bz2 | |
fix(ngInclude): only run anchorScroll after animation is done
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.
Fixes #4723
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/directive/ngInclude.js | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index f4b84fcf..7ca9a48b 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -176,6 +176,11 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'          };          scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) { +          var afterAnimation = function() { +            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { +              $anchorScroll(); +            } +          };            var thisChangeId = ++changeCounter;            if (src) { @@ -190,13 +195,8 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'                  currentElement = clone;                  currentElement.html(response); -                $animate.enter(currentElement, null, $element); +                $animate.enter(currentElement, null, $element, afterAnimation);                  $compile(currentElement.contents())(currentScope); - -                if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { -                  $anchorScroll(); -                } -                  currentScope.$emit('$includeContentLoaded');                  scope.$eval(onloadExp);                }); | 
