refactor(slideBox): work w/ parent scope disconnect

This commit is contained in:
Adam Bradley
2014-12-08 11:24:44 -06:00
parent 4130c5a1c3
commit 1a785afb0a
2 changed files with 7 additions and 1 deletions

View File

@@ -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;