You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-8Lines changed: 58 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,17 +29,21 @@ This project will return the whole angular module so if you want to use as a dep
29
29
30
30
## How to use
31
31
32
-
The two main directivesare `ng-intro-options` and `ng-intro-method`.
32
+
You can use the two main directives, which are `ng-intro-options` and `ng-intro-method`, or you can include the service called `ngIntroService`
33
33
34
34
### Setting Options
35
35
36
-
`ng-intro-options="IntroOptions"`
36
+
**As a directive** - `ng-intro-options="IntroOptions"`
37
+
38
+
**As a service** - `ngIntroService.setOptions(IntroOptions)`
37
39
38
40
You should create a `$scope.IntroOptions` in your controller which contains the intro.js options. The options are exactly the same as [the original](https://github.com/usablica/intro.js/wiki/Documentation#options). 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.
39
41
40
42
### Start method
41
43
42
-
`ng-intro-method="CallMe"`
44
+
**As a directive** - `ng-intro-method="CallMe"`
45
+
46
+
**As a service** - `ngIntroService.start()`
43
47
44
48
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.
45
49
@@ -61,10 +65,12 @@ If you set `ng-intro-autostart="true"`, the intro will start as soon as the dire
61
65
62
66
If an intro tour includes dynamic content, use `ng-intro-autorefresh="true"` to call Intro.js' refresh method.
63
67
64
-
###Callbacks
68
+
## Callbacks
65
69
66
70
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.
67
71
72
+
### As a directive
73
+
68
74
`ng-intro-onchange="ChangeEvent"`
69
75
70
76
In your controller, create `ChangeEvent`
@@ -77,17 +83,61 @@ In your controller, create `ChangeEvent`
77
83
78
84
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`.
79
85
86
+
### As a service
87
+
88
+
There are two ways of make use of callbacks:
89
+
90
+
**Using promises**
91
+
92
+
The methods that return promises:
93
+
94
+
*`onComplete`
95
+
*`onExit`
96
+
*`onBeforeChange`
97
+
*`onAfterChange`
98
+
*`onChange`
99
+
100
+
**Using watches (not recommended, available for compatibility)**
0 commit comments