Slide-box refactor: slide-state="detached" after back button + slide-box state restoration


#1

Hi all,

I’m having some problems with the slide box since the refactor. I am using some custom code to store the state of the slide-box in a service, and then when using a back button to return to the view, I check for and restore the state of the slidebox (to open on slide 2 with search assets populated).

The problem is that the slidebox restores properly and opens on slide index 2, but all of the slides in the slidebox are detached. I see slide-state=“detached” in my inspector and the slide is blank. As soon as I drag the slide with my finger, the slides attach and appear. This is reproducible in Chrome as well as the phone.

I’ve tried adding a $ionicSlideBoxDelegate.update() to no avail. Here is my code to restore the slide box contents and position:

	if (currentModel.check()) {
	console.log('found currentModel');
	var newCurrentModel = currentModel.get();
	console.log(newCurrentModel);
	$scope.templates.categories = newCurrentModel.categories;
	if ($scope.templates.categories.length == 0) {
		$rootScope.somethingSelected = false;			
	} else {
		$rootScope.somethingSelected = true;	
	}
	$scope.searchString = newCurrentModel.searchString;
	console.log('retrieved categories: ', $scope.templates.categories);
	console.log('retrieved searchString: ', $scope.searchString);

	$scope.searchResults = selectedSearchBundles.get();
	$scope.restoring = true;
	$rootScope.activeSearchSlide = 2;
	$ionicSlideBoxDelegate.update();	// doesn't do anything
}

Slidebox Refactor landed in nightly with huge API changes
#2

Any thoughts? Anyone else having this problem?


#3

Is it a problem, perhaps, to be binding the active slide to the rootscope?


#4

Can you create a plunkr?

I fixed a selection problem in the latest nightly.


#5

Oh, I have much bigger problems now. I think the new state caching features are conflicting with my manual state storage and repopulating. I’m either going to have to turn off state caching and continue with my hack, or deconstruct my hack and see if the state caching actually works (repopulating scope variables, slidebox slide position, etc).

I’ll let you know when I tackle this problem.