From 0a435fa1dc8d499670d428fac27cc28998682e19 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 23 Sep 2016 15:35:19 -0400 Subject: [PATCH] Fix Angular bug on plans page when using back button Angular apparently tries to read the DOM that is being manipulated simultaneously by bootstrap, which results it a state inconsistency (since the DOM is changing) and an Angular failure. This change ensure that the modal call happens outside of the initial digest loop and therefore, appears to solve the problem (translation: who the heck knows why it works, but it does). Fixes #1869 --- static/js/directives/ui/plans-display.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/directives/ui/plans-display.js b/static/js/directives/ui/plans-display.js index 3a79579c8..6a9bf42ce 100644 --- a/static/js/directives/ui/plans-display.js +++ b/static/js/directives/ui/plans-display.js @@ -11,7 +11,7 @@ angular.module('quay').directive('plansDisplay', function () { restrict: 'C', scope: { }, - controller: function($scope, $element, $routeParams, UserService, PlanService, UIService) { + controller: function($scope, $element, $routeParams, $timeout, UserService, PlanService, UIService) { // Monitor any user changes and place the current user into the scope. UserService.updateUserIn($scope); @@ -33,7 +33,9 @@ angular.module('quay').directive('plansDisplay', function () { if ($scope.user && !$scope.user.anonymous) { PlanService.handleNotedPlan(); } else { - $('#signinModal').modal({}); + $timeout(function() { + $('#signinModal').modal({}); + }, 0); } };