How it works?
Demo
https://miraxes.github.io/angular-custom-tour
Custom tour with Angular 2.x.x
Follow instructions and everything should be fine. :)
Usage
- install
npm install angular-custom-tour --save
In your module (app.module.ts)
import { HintModule } from 'angular-custom-tour'
@NgModule({
...
imports: [
...
HintModule
...
]
...
]
Initialize it in your page component
import { HintService } from 'angular-custom-tour'
@Component({
...
providers: [... HintService ... ],
...
})
class AppComponent {
constructor(public hintService: HintService){ }
startTour() {
this.hintService.initialize();
}
}
NOTE:
In case you want to init slider after pageload, you should use ngAfterViewInit
<tour-overlay></tour-overlay>
<button name="button" (click)="startTour()"> START!</button>
<div class="i-want-highlight-this" id="highlight-me"> WOW!</div>
<tour-step selector="highlight-me" order="3" position="right" title="title string">
</tour-step>
NOTE:
selector MUST BE unique, so you can highlight Element once
Also you need to inject styles from styles/main.css
Custom options Usage
startTour() {
this.hintService.initialize({elementsDisabled: false});
}
}
HintOptions
option | default | Usage |
---|
elementsDisabled: boolean | true | Disabling highlightedElement (click) wont work |
dismissOnOverlay: boolean | false | Go to next step when clicking on overlay (close tour if this is last step) |
defaultPosition: string | 'bottom' | Position of tour step to highlightedElement |
defaultOrder: number | 99 | Order of showing steps |
defaultLayer: number | 15 | Distance between highlightedElement and step in px |
applyRelative: boolean | true | Applying position:relative to highlightedElement (disable in case you want to highligh absolute positioned elements) |
This module in active development mode, if you have any suggestions fell free to contact me.