Comments (3)
@AlexCln what I did to solve this problem is have an anchor point off the screen. I would then use that anchor point as a transition step. So my step configuration was something like this:
[
{
stepId: 'firstStep'
anchorId: 'some.anchor.id'
},
{
stepId: 'toggleMenuRedirect'
anchorId: 'offscreenAnchor'
},
{
prevStep: 'firstStep',
stepId: 'menuStep'
anchorId: 'menu.anchor.id'
}
]
then I would use the stepShow$ to detect when you are going to the toggleMenuRedirect step and then go to the next step:
this.tourService.stepShow$.subscribe( (step: IStepOption) => {
switch (step.stepId){
case "toggleMenuRedirect":
this.myVariable = true;
this.tourService.next();
break;
}
});
then on the stepHide$ callback of the menuStep step, you would set it back to false
this.tourService.stepHide$.subscribe( (step: IStepOption) => {
switch (step.stepId){
case "menuStep":
this.myVariable = false;
break;
}
});
This is a bit of a workaround though. It would be nice @isaacplmann if there could be functions on the IStepOption object for onEnter and onLeave that would wait for the function to finish in the case of it returning a Promise or an Observable.
from ngx-tour.
Yes. The stepShow$
observable emits a value every time a new step is shown. So you can use it like this:
// step2 is defined up here somewhere
this.tourService.stepShow$.subscribe((step: IStepOption) => {
if (step === step2) { // or step.anchorId === step2.anchorId
this.myVariable = 'This is step 2!';
}
});
Note: This code will execute any time step 2 is shown - so if you start the tour directly on step 2 or go from step 1 to 2 or from step 3 back to 2.
from ngx-tour.
Thanks for your answer, I've found a solution:
In app.component.ts
:
this.tourService.stepShow$.subscribe( (res: any) => {
switch (res.Step){
case"2":
this.myVariable = true;
break;
....
}
});
and to close :
this.tourService.stepHide$.subscribe( (res: any) => {
switch (res.Step){
case"2": //for the same step
this.myVariable = false;
break;
....
}
});
Now I got a position problem with the card because my toggleMenu is in position: absolute
and the card is fixed to top: 0px; left: 0px
Regards
from ngx-tour.
Related Issues (20)
- Adding maintainers HOT 6
- After update angular 10 I have got a compilation errors. HOT 5
- backdrop not work properly on some tag HOT 1
- show each step after that contents completely render HOT 3
- Move ngxpopper documentation to branch until it's reinstated
- ngx-tour-ng-bootstrap Compilation error HOT 1
- Cannot find module 'ngx-bootstrap'
- Relase ngx-tour-ngx-bootstrap HOT 1
- ERROR in node_modules/ngx-tour-core/lib/tour.service.d.ts(2,13): error TS1005: '=' expected. HOT 4
- Enable HTML tags in step content HOT 1
- enableBackdrop missing in IStepOption? HOT 1
- Overlay doesn't go away on navigating back HOT 1
- Skip a step when the anchorId is undefined HOT 2
- ngx-tour-ngx-popper not intantiating twice in the same module HOT 1
- No provider for TourStepTemplateService! issue while running test with Jest.
- Sriram HOT 2
- All steps render off screen at bottom
- Cannot set properties of undefined (setting 'step')
- Find bug on latest version of lib, cannot go on next step if user not set stepId on IStepOption object
- Overlay not hiding properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-tour.