Skip to content
This repository was archived by the owner on Jan 17, 2022. It is now read-only.

Commit 99a846d

Browse files
author
Takenaka Simon
committed
add support for hints API
1 parent 20684fe commit 99a846d

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"dependencies": {
1515
"angular": "^1.4.0",
16-
"intro.js": "~2.3.0"
16+
"intro.js": "~2.4.0"
1717
},
1818
"devDependencies": {}
1919
}

src/angular-intro.js

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@
3434
ngIntroOnbeforechange: '=',
3535
ngIntroOnafterchange: '=',
3636
ngIntroAutostart: '=',
37-
ngIntroAutorefresh: '='
37+
ngIntroAutorefresh: '=',
38+
39+
ngIntroHintsMethod: "=?",
40+
ngIntroOnhintsadded: "=",
41+
ngIntroOnhintsclicked: "=?",
42+
ngIntroOnhintclose: "=?",
43+
ngIntroShowHint: "=?",
44+
ngIntroShowHints: "=?",
45+
ngIntroHideHint: "=?",
46+
ngIntroHideHints: "=?"
3847
},
3948
link: function(scope, element, attrs) {
4049

@@ -111,6 +120,48 @@
111120
}
112121
};
113122

123+
scope.ngIntroHintsMethod = function() {
124+
if (typeof(introJs) !== 'function') {
125+
throw new IntroJsNotAvailable();
126+
}
127+
128+
navigationWatch = scope.$on('$locationChangeStart', function(){
129+
intro.exit();
130+
});
131+
132+
if (typeof(step) === 'string') {
133+
intro = introJs(step);
134+
135+
} else {
136+
intro = introJs();
137+
}
138+
139+
intro.setOptions(scope.ngIntroOptions);
140+
141+
if(scope.ngIntroOnhintsadded) {
142+
intro.onhintsadded(function() {
143+
scope.ngIntroOnhintsadded.call(this, scope);
144+
$timeout(function() {scope.$digest();});
145+
});
146+
}
147+
148+
if(scope.ngIntroOnhintclick) {
149+
intro.onhintclick(function(hintElement, item, stepId) {
150+
scope.ngIntroOnhintclick.call(this, hintElement, hintElement, item, stepId, scope);
151+
$timeout(function() {scope.$digest();});
152+
});
153+
}
154+
155+
if(scope.ngIntroOnhintclose) {
156+
intro.onhintclose(function (stepId) {
157+
scope.ngIntroOnhintclose.call(this, stepId, scope);
158+
$timeout(function() {scope.$digest();});
159+
});
160+
}
161+
162+
intro.addHints();
163+
};
164+
114165
scope.ngIntroNextMethod = function () {
115166
intro.nextStep();
116167
};
@@ -130,6 +181,22 @@
130181
intro.refresh();
131182
};
132183

184+
scope.ngIntroShowHint = function(id) {
185+
intro.showHint(id);
186+
};
187+
188+
scope.ngIntroShowHints = function() {
189+
intro.showHints();
190+
};
191+
192+
scope.ngIntroHideHint = function(id) {
193+
intro.hideHint(id);
194+
};
195+
196+
scope.ngIntroHideHints = function() {
197+
intro.hideHints();
198+
};
199+
133200
var autoStartWatch = scope.$watch('ngIntroAutostart', function () {
134201
if(scope.ngIntroAutostart){
135202
$timeout(function() {

0 commit comments

Comments
 (0)