Skip to content

Commit aeb6da1

Browse files
author
mendhak
committed
Fixed remaining intro.js callbacks to pass targetElement
1 parent 00264fb commit aeb6da1

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

build/angular-intro.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ app.controller('MyController', function ($scope) {
1010
console.log("Exit Event called");
1111
};
1212

13-
$scope.ChangeEvent = function () {
13+
$scope.ChangeEvent = function (targetElement) {
1414
console.log("Change Event called");
15+
console.log(targetElement);
1516
};
1617

1718
$scope.BeforeChangeEvent = function (targetElement) {
1819
console.log("Before Change Event called");
1920
console.log(targetElement);
2021
};
2122

22-
$scope.AfterChangeEvent = function () {
23+
$scope.AfterChangeEvent = function (targetElement) {
2324
console.log("After Change Event called");
25+
console.log(targetElement);
2426
};
2527

2628
$scope.IntroOptions = {

example/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
<body>
1919
<div class="container-narrow" ng-controller="MyController"
2020
ng-intro-options="IntroOptions" ng-intro-method="CallMe"
21-
ng-intro-oncomplete="CompletedEvent()" ng-intro-onexit="ExitEvent()"
22-
ng-intro-onchange="ChangeEvent()" ng-intro-onbeforechange="BeforeChangeEvent"
23-
ng-intro-onafterchange="AfterChangeEvent()"
21+
ng-intro-oncomplete="CompletedEvent" ng-intro-onexit="ExitEvent"
22+
ng-intro-onchange="ChangeEvent" ng-intro-onbeforechange="BeforeChangeEvent"
23+
ng-intro-onafterchange="AfterChangeEvent"
2424
ng-intro-autostart="false">
2525

2626
<div class="masthead">

src/angular-intro.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ ngIntroDirective.directive('ngIntroOptions', ['$timeout', function ($timeout) {
88
scope: {
99
ngIntroMethod: "=",
1010
ngIntroOptions: '=',
11-
ngIntroOncomplete: '&',
12-
ngIntroOnexit: '&',
13-
ngIntroOnchange: '&',
11+
ngIntroOncomplete: '=',
12+
ngIntroOnexit: '=',
13+
ngIntroOnchange: '=',
1414
ngIntroOnbeforechange: '=',
15-
ngIntroOnafterchange: '&',
15+
ngIntroOnafterchange: '=',
1616
ngIntroAutostart: '@'
1717
},
1818
link: function(scope, element, attrs) {
@@ -38,21 +38,23 @@ ngIntroDirective.directive('ngIntroOptions', ['$timeout', function ($timeout) {
3838
}
3939

4040
if(scope.ngIntroOnchange) {
41-
intro.onchange(scope.ngIntroOnchange);
41+
intro.onchange(function(targetElement){
42+
$timeout(function() { scope.ngIntroOnchange(targetElement)});
43+
});
4244
}
4345

4446
if(scope.ngIntroOnbeforechange) {
45-
4647
intro.onbeforechange(function(targetElement) {
4748
$timeout(function() {
48-
scope.$apply( scope.ngIntroOnbeforechange(targetElement) );
49+
scope.ngIntroOnbeforechange(targetElement) ;
4950
}, 0);
5051
});
51-
5252
}
5353

5454
if(scope.ngIntroOnafterchange) {
55-
intro.onafterchange(scope.ngIntroOnafterchange);
55+
intro.onafterchange(function(targetElement){
56+
$timeout(function() { scope.ngIntroOnafterchange(targetElement); });
57+
});
5658
}
5759

5860
if(typeof(step) === 'number') {

0 commit comments

Comments
 (0)