angular-shepherd icon indicating copy to clipboard operation
angular-shepherd copied to clipboard

Question: remove steps?

Open hebertlima opened this issue 4 years ago • 5 comments

Hi there!

is there any way to remove all steps?

in the official documentation there is a destroy() method but it didn't work:

something like:

this.onboarding.addSteps([]); // exists
this.onboarding.removeStep(name);
this.onboarding.remove();
this.onboarding.destroy(); 

hebertlima avatar Sep 23 '21 22:09 hebertlima

destroy is for steps, not for the tour itself. There is not a way to destroy all the steps. However, if you are using this angular wrapper, each time you call addSteps it creates a new tour, so that should be doing what you want.

RobbieTheWagner avatar Sep 24 '21 01:09 RobbieTheWagner

Thanks for the quick response! I'm using a components extends architecture, so every time a component is loaded, all the data is persisted and this causes an overload of steps (each component have diferents steps and all push into this.onboarding.addSteps([]);), my intention would be to destroy or reset the steps within the ngOnDestroy() from each component.

hebertlima avatar Sep 24 '21 03:09 hebertlima

@hebertlima I don't understand. addSteps in this package will make a new tour every time, so you just need to pass it whatever steps you want to display.

RobbieTheWagner avatar Sep 24 '21 16:09 RobbieTheWagner

I reproduced here:

https://stackblitz.com/edit/angular-tmx2ax?file=src/app/base/base.component.ts

I think I messed something up

hebertlima avatar Sep 24 '21 21:09 hebertlima

@hebertlima I don't see anything running there.

RobbieTheWagner avatar Sep 26 '21 13:09 RobbieTheWagner