App Intro Walkthrough slide box


#1

In the “App Intro Walkthrough” demo how would you make the toIntro function start again at the first slide? I would have thought $ionicSlideBoxDelegate.slide(0); but that doesn’t do it.


#2

I guess you need to call $state.go('intro') from your controller. Is that what you mean?


#3

That’s what the demo does but it shows the last slide. I want to go back to the intro’s first slide.


#4

You were right. Take a look at this codepen, now it works but I’ve set the view cache to 0 when initializing the controller. That means your views within the main app won’t be cached, not sure if that’s good.
Maybe there is a better solution.

EDIT: Better solution now, disabling the cache for the intro app view. Take a look at the codepen below.


#5

Thanks, that does it but how about if I wanted to start the intro again at the second slide? Why doesn’t $ionicSlideBoxDelegate.slide(1) work from the main controller?


#6

The problem is with app states. Once you redirect to the main app with $state.go('main') you can no longer use $ionicSlideBoxDelegate because that belongs in another view.
But you can set up some logic within the intro controller to redirect. I have updated the codepen with a sample.


#7

That all makes sense. Thanks for the help,


#8

Have you checked the latest codepen changes? There’s a working solution to your use case. Best approach would be to use state parameters, but as I’ve pointed out it did not work with codepen, perhaps it works locally with ionic serve.


#9

I put the codepen logic in my app and it works great. Thanks again.