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

Commit

Permalink
Exit introjs on a navigation event.
Browse files Browse the repository at this point in the history
- Prevents overlay hanging around if the user changes the page with
browser back/forward
  • Loading branch information
igmcdowell committed Jan 28, 2015
1 parent b429185 commit 785ac1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/angular-intro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/angular-intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ ngIntroDirective.directive('ngIntroOptions', ['$timeout', function ($timeout) {
scope.ngIntroMethod = function(step) {

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

if (typeof(step) === 'string') {
intro = introJs(step);
Expand All @@ -39,12 +42,14 @@ ngIntroDirective.directive('ngIntroOptions', ['$timeout', function ($timeout) {
if (scope.ngIntroOncomplete) {
intro.oncomplete(function() {
$timeout(scope.ngIntroOncomplete.bind(this, scope));
navigationWatch();
});
}

if (scope.ngIntroOnexit) {
intro.onexit(function() {
$timeout(scope.ngIntroOnexit.bind(this, scope));
navigationWatch();
});
}

Expand Down

0 comments on commit 785ac1f

Please sign in to comment.