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

Commit e5df025

Browse files
committed
Check if Intro.js is available and throw an error if not.
1 parent 5595f09 commit e5df025

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/angular-intro.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
var ngIntroDirective = angular.module('angular-intro', []);
1414

15+
function IntroJsNotAvailable () {
16+
this.message = 'Intro.js is not available. Make sure it is properly loaded.';
17+
this.name = 'IntroJsNotAvailable';
18+
}
1519

1620
ngIntroDirective.directive('ngIntroOptions', ['$timeout', function ($timeout) {
1721

@@ -40,6 +44,9 @@
4044

4145
scope.ngIntroMethod = function(step) {
4246

47+
if (typeof(introJs) !== 'function') {
48+
throw new IntroJsNotAvailable();
49+
}
4350

4451
navigationWatch = scope.$on('$locationChangeStart', function(){
4552
intro.exit();

0 commit comments

Comments
 (0)