Skip to content

Commit 9eb30b5

Browse files
author
mendhak
committed
Added callback event directives
1 parent b2221ca commit 9eb30b5

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

angular-intro.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ ngIntroDirective.directive('ngIntro', [function () {
2222

2323
intro.setOptions(scope[attrs.ngIntroOptions]);
2424

25+
if(attrs.ngIntroOncomplete){
26+
intro.oncomplete(scope[attrs.ngIntroOncomplete]);
27+
}
28+
29+
if(attrs.ngIntroOnexit){
30+
intro.onexit(scope[attrs.ngIntroOnexit]);
31+
}
32+
33+
if(attrs.ngIntroOnchange){
34+
intro.onchange(scope[attrs.ngIntroOnchange]);
35+
}
36+
37+
if(attrs.ngIntroOnbeforechange){
38+
intro.onbeforechange(scope[attrs.ngIntroOnbeforechange]);
39+
}
40+
41+
42+
2543
if(typeof(step)=="number"){
2644
intro.goToStep(step).start();
2745
}

example/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
<body >
2222

23-
<div class="container-narrow" ng-controller="MyController" ng-intro="" ng-intro-options="IntroSnippets" ng-intro-method="CallMe">
23+
<div class="container-narrow" ng-controller="MyController"
24+
ng-intro="" ng-intro-options="IntroSnippets" ng-intro-method="CallMe"
25+
ng-intro-oncomplete="CompletedEvent" ng-intro-onexit="ExitEvent"
26+
ng-intro-onchange="ChangeEvent" ng-intro-onbeforechange="BeforeChangeEvent">
2427

2528
<div class="masthead">
2629
<ul id="step5" class="nav nav-pills pull-right">

lib/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ var app = angular.module('myApp', ['angular-intro']);
22

33
app.controller('MyController', function ($scope) {
44

5+
$scope.CompletedEvent = function () { console.log("Completed Event called"); };
6+
7+
$scope.ExitEvent = function () { console.log("Exit Event called");};
8+
9+
$scope.ChangeEvent = function () { console.log("Change Event called"); };
10+
11+
$scope.BeforeChangeEvent = function () { console.log("Before Change Event called"); };
12+
513
$scope.IntroSnippets = {
614
steps:[
715
{

0 commit comments

Comments
 (0)