aboutsummaryrefslogtreecommitdiffstats
path: root/docs/components/angular-bootstrap
diff options
context:
space:
mode:
authorIgor Minar2013-11-06 23:00:10 +0000
committerIgor Minar2013-11-08 01:03:17 -0800
commit1df3da361d62726bf1dafe629a7fca845b6a8733 (patch)
tree3d43c51786c409abd952216c957dde76dca4002d /docs/components/angular-bootstrap
parent27e9340b3c25b512e45213b39811098d07e12e3b (diff)
downloadangular.js-1df3da361d62726bf1dafe629a7fca845b6a8733.tar.bz2
fix(bootstrap-prettify): share $animate and $$postDigestQueue with demo apps
Although demo apps run in an isolated environment, we need to be able to tell them to disable animations when we are running end-to-end tests. By sharing the same instance of $animate between the two environments we can disable animation across the board. The $animate service uses the $$postDigestQueue to run animations. The outer $animate service uses the outer $$postDigestQueue and to queue up these animations. This means that when we run a digest inside the embedded scope, the animations are never performed - they just sit in the outer scope's queue and are only run when a digest is run on the outer scope. By sharing this queue across the two scopes the animations are performed correctly.
Diffstat (limited to 'docs/components/angular-bootstrap')
-rw-r--r--docs/components/angular-bootstrap/bootstrap-prettify.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/components/angular-bootstrap/bootstrap-prettify.js b/docs/components/angular-bootstrap/bootstrap-prettify.js
index 101bc801..43248943 100644
--- a/docs/components/angular-bootstrap/bootstrap-prettify.js
+++ b/docs/components/angular-bootstrap/bootstrap-prettify.js
@@ -192,7 +192,7 @@ directive.ngEvalJavascript = ['getEmbeddedTemplate', function(getEmbeddedTemplat
directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location', '$sniffer', '$animate',
- function($templateCache, $browser, docsRootScope, $location, $sniffer, $animate) {
+ function($templateCache, $browser, docsRootScope, $location, $sniffer, $animate) {
return {
terminal: true,
link: function(scope, element, attrs) {
@@ -205,6 +205,7 @@ directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location',
$provide.value('$anchorScroll', angular.noop);
$provide.value('$browser', $browser);
$provide.value('$sniffer', $sniffer);
+ $provide.value('$animate', $animate);
$provide.provider('$location', function() {
this.$get = ['$rootScope', function($rootScope) {
docsRootScope.$on('$locationChangeSuccess', function(event, oldUrl, newUrl) {
@@ -227,6 +228,11 @@ directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location',
}]);
$provide.decorator('$rootScope', ['$delegate', function($delegate) {
embedRootScope = $delegate;
+
+ // Since we are teleporting the $animate service, which relies on the $$postDigestQueue
+ // we need the embedded scope to use the same $$postDigestQueue as the outer scope
+ embedRootScope.$$postDigestQueue = docsRootScope.$$postDigestQueue;
+
deregisterEmbedRootScope = docsRootScope.$watch(function embedRootScopeDigestWatch() {
embedRootScope.$digest();
});