GithubHelp home page GithubHelp logo

weicracker / angular-intro.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mendhak/angular-intro.js

1.0 1.0 0.0 1.27 MB

AngularJS directives for intro.js

Home Page: http://code.mendhak.com/angular-intro.js/

License: GNU Affero General Public License v3.0

JavaScript 38.86% CSS 6.82% HTML 54.32%

angular-intro.js's Introduction

angular-intro.js Build Status

An angularjs directive that wraps intro.js functionality.

angularintro

See the project page for an overview.

Bower

You can install this package through Bower by using the following command :

bower install angular-intro.js --save

NPM

You can install this package through NPM by using the following command :

npm install angular-intro.js --save

Webpack

You can use this package in your webpack project, first by including intro.js and its css file. Next you need to require this package.

import ngIntro from 'angular-intro.js';

This project will return the whole angular module so if you want to use as a dependency in your own angular module you would need to reference the name ngIntro.name.

How to use

The two main directives are ng-intro-options and ng-intro-method.

Setting Options

ng-intro-options="IntroOptions"

You should create a $scope.IntroOptions in your controller which contains the intro.js options. The options are exactly the same as the original. This also allows you to modify the options as part of your controller behavior if necessary. You don't have to use IntroOptions, you can specify some other name.

Start method

ng-intro-method="CallMe"

The directive will create a method on $scope.CallMe so that you can invoke it yourself later. Make sure the there isn't a method CallMe already in your controller. To use the method be sure to wrap it with $timeout. You don't have to use CallMe, you can specify some other name.

Call the start method

You can invoke it from an event such a click,

ng-click="CallMe();"

as long as you are still in the same controller scope. You can also specify a step number in the method call, CallMe(3);.

You can start the intro from code, either call $scope.CallMe();. If the $scope.CallMe(); doesn't work, it might be because your DOM isn't ready. Put it in a $timeout.

Autostart

If you set ng-intro-autostart="true", the intro will start as soon as the directive is ready.

Autorefresh

If an intro tour includes dynamic content, use ng-intro-autorefresh="true" to call Intro.js' refresh method.

Callbacks

Intro.js provides several callbacks. You can receive these callbacks in your controller. For example, for the onchange event, specify the function name in the directive.

ng-intro-onchange="ChangeEvent"

In your controller, create ChangeEvent

$scope.ChangeEvent = function (targetElement, scope) {
    console.log("Change Event called");
    console.log(targetElement); //The target element
    console.log(this); //The IntroJS object
};

The other intro.js callbacks you can specify are ng-intro-oncomplete, ng-intro-onexit, ng-intro-onchange ng-intro-onbeforechange and ng-intro-onafterchange.

Exit Method

ng-intro-exit-method="ExitMe"

Then in your controller, you can force exit using

$scope.ExitMe(function() { //callback } );

Plunker

You can also use this sample plunker

How to build

If you want to build or contribute, first, get the node modules needed (grunt, bower)

npm install

Next, use bower to get the JS libraries needed

node_modules/.bin/bower install

Then, whenever you make any changes, get grunt to build the minified angular-intro.min.js

node_modules/.bin/grunt

Finally, view the demo page to make sure everything's working; start a web server:

./node_modules/.bin/grunt connect:server

And browse to http://localhost:8000/example/index.html

License

As with intro.js, this is under the MIT license.

angular-intro.js's People

Contributors

mendhak avatar flekschas avatar eckerdecker avatar ilovett avatar igmcdowell avatar pavelivanov avatar ryanrhodes avatar balthazar avatar billykov avatar canercandan avatar coryk135 avatar jonykalavera avatar mez avatar masimplo avatar bobey avatar knvpk avatar stevenw00 avatar timfjord avatar itrethan avatar iuryalves avatar j0hnsmith avatar

Stargazers

Ji Wei avatar

Watchers

Ji Wei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.