From 1a785afb0a0ee6fcee1c281c605c12c53b0d0407 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 8 Dec 2014 11:24:44 -0600 Subject: [PATCH] refactor(slideBox): work w/ parent scope disconnect --- js/angular/controller/slideBoxController.js | 6 +++++- js/utils/utils.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/angular/controller/slideBoxController.js b/js/angular/controller/slideBoxController.js index a6e3b84bd8..8c927cd706 100644 --- a/js/angular/controller/slideBoxController.js +++ b/js/angular/controller/slideBoxController.js @@ -322,7 +322,7 @@ function(scope, element, $log, $document, $$q, $timeout, $interval, $$ionicAttac function setDisplay(slide, display) { if (!slide) return; var slideScope = jqLite(slide).data('$ionSlideScope'); - if (slideScope) { + if (slideScope && !ionic.Utils.isScopeDisconnected(scope)) { ionic.Utils.reconnectScope(slideScope); // Digest the slide so it updates before being shown if (!$rootScope.$$phase) slideScope.$digest(); @@ -334,6 +334,10 @@ function(scope, element, $log, $document, $$q, $timeout, $interval, $$ionicAttac currentDisplayed = newDisplayed; } + scope.$on('$ionic.reconnectScope', function() { + setDisplayedSlides(self.previous(), self.selected(), self.next()); + }); + function getDelta(fromIndex, toIndex) { var difference = toIndex - fromIndex; if (!isLoop) return difference; diff --git a/js/utils/utils.js b/js/utils/utils.js index 23d593c8c6..201697c326 100644 --- a/js/utils/utils.js +++ b/js/utils/utils.js @@ -182,6 +182,7 @@ } var parent = scope.$parent; scope.$$disconnected = true; + scope.$broadcast('$ionic.disconnectScope'); // See Scope.$destroy if (parent.$$childHead === scope) { parent.$$childHead = scope.$$nextSibling; @@ -209,6 +210,7 @@ } var parent = scope.$parent; scope.$$disconnected = false; + scope.$broadcast('$ionic.reconnectScope'); // See Scope.$new for this logic... scope.$$prevSibling = parent.$$childTail; if (parent.$$childHead) {