Socket
Socket
Sign inDemoInstall

ng5-bootstrap-product-tour

Package Overview
Dependencies
10
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ng5-bootstrap-product-tour

Angular product tour using ngx-bootstrap popover (Only for NG5)


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
446 kB
Created
Weekly downloads
 

Readme

Source

ngx-bootstrap-product-tour

npm version

About

This is a product tour library built with Angular (2+). NgxBootstrapProductTourModule is an implementation of the tour ui that uses ngx-bootstrap popovers to display tour steps.

For Angular 4 use package version 1.0.6

For Angular 5 use package version 2.0.x

Installation

  1. npm i ngx-bootstrap-product-tour ngx-bootstrap bootstrap
  2. Import NgxBootstrapProductTourModule.forRoot() into your app module
  3. Make sure RouterModule is imported in your app module
  4. Include bootstrap css.

Usage

  1. Add <ngx-bootstrap-product-tour></ngx-bootstrap-product-tour> to your root app component

  2. Define anchor points for the tour steps by adding the tourAnchor directive throughout your app.

    <div tourAnchor="some.anchor.id">...</div>
    
  3. Define your tour steps using tourService.initialize(steps)

    this.tourService.initialize([{
      anchorId: 'some.anchor.id',
      content: 'Some content',
      title: 'First',
    }, {
      anchorId: 'another.anchor.id',
      content: 'Other content',
      title: 'Second',
    }]);
    
  4. Start the tour with tourService.start()

Demo

Demo page can be found here and it's source code here.

TourService

The TourService controls the tour. Some key functions include

FunctionDescription
start()Starts the tour
startAt(stepId: number | string)Start the tour at the step with stepId or at the specified index
end()Ends the tour
pause()Pauses the tour
resume()Resumes the tour
next()Goes to the next step
prev()Goes to the previous step

Step Configuration

Each step can have the following properties.

NameTypeDefaultDescription
stepIdstring""A unique identifier for the step
anchorIdstringrequiredThe anchor to which the step will be attached
titlestring""The title of the tour step
contentstring""The content text of the tour step
routestringUrlSegment[]undefined
nextStepnumberstringundefined
prevStepnumberstringundefined
placement'top' | 'bottom' | 'right' | 'left''top'Where the tour step should placed with respect to the anchor.
preventScrollingbooleanfalseTour steps automatically scroll to the middle of the screen, if they are off the screen when shown. Setting this value to true will disable the scroll behavior.
containerClassstring""Css class for popover container.
orphanbooleanfalseTour popover will be placed in the center of the screen, must have anchorId but it won't be shown next to that element.
promisepromise<any>""Step shows after promise has been resolved.
delaynumber0Time in milliseconds before showing the tour step.
backdropbooleanfalseShows/hides backdrop. You need to set backgroud color and z-index on class .tour-backdrop and higher z-index on .tour-step-backdrop.

Defaults

You can set default values in the TourService.initialize function.

this.tourService.initialize(steps, {{ '{' }}
  route: '',
  placement: 'left',
  preventScrolling: true,
});

Any value explicitly defined in a step will override the default value.

Event Observables

The TourService emits events that can be subscribed to like this:

this.tourService.initialize$.subscribe((steps: IStep[]) => {{ '{' }}
  console.log('tour configured with these steps:', steps);
});
NamePayloadEmitted When
stepShow$IStepA step is shown
stepHide$IStepA step is hidden
initialize$IStep[]The tour is configured with a set of steps
start$IStepThe tour begins
end$anyThe tour ends
pause$IStepThe tour is paused
resume$IStepIThe tour resumes
anchorRegister$stringAn anchor is registered with the tour
anchorUnregister$stringAn anchor is unregistered from the tour

Custom template

You can also customize the tour step template by providing an <ng-template> inside the <ngx-bootstrap-product-tour>

The default template is equivalent to this:

<ngx-bootstrap-product-tour>
  <ng-template #tourStep>
    <p class="tour-step-content">{{tourService.currentStep.content}}</p>
    <div class="tour-step-navigation">
      <button *ngIf="tourService.hasPrev(tourService.currentStep)" class="btn btn-sm btn-default" (click)="tourService.prev()">« Prev</button>
      <button *ngIf="tourService.hasNext(tourService.currentStep)" class="btn btn-sm btn-default" (click)="tourService.next()">Next »</button>
      <button class="btn btn-sm btn-error" (click)="tourService.end()">End</button>
    </div>
  </ng-template>
</ngx-bootstrap-product-tour>

Keywords

FAQs

Last updated on 05 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc