diff --git a/README.md b/README.md index 1abd184..0577d11 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,9 @@ $scope.onboardingSteps = [ position: "right", description: "This is the form for configuring your account.", attachTo: "#account_form", - position: "bottom" + position: "bottom", + nextFunction: function nextClick () { alert('Next btn clicked') }, + prevFunction: function prevClick () { alert('prev button clicked') } } ]; ``` diff --git a/src/ng-onboarding.coffee b/src/ng-onboarding.coffee index b24a993..8a501ad 100644 --- a/src/ng-onboarding.coffee +++ b/src/ng-onboarding.coffee @@ -52,12 +52,18 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', link: (scope, element, attrs) -> # Important Variables curStep = null - attributesToClear = ['title', 'top', 'right', 'bottom', 'left', 'width', 'height', 'position'] + attributesToClear = ['title', 'top', 'right', 'bottom', 'left', 'width', 'height', 'position', 'nextFunction', 'prevFunction'] scope.stepCount = scope.steps.length # Button Actions - scope.next = -> scope.index = scope.index + 1 - scope.previous = -> scope.index = scope.index - 1 + scope.next = -> + if scope.steps[scope.index].nextFunction + scope.steps[scope.index].nextFunction(); + scope.index = scope.index + 1 + scope.previous = -> + if scope.steps[scope.index].prevFunction + scope.steps[scope.index].prevFunction(); + scope.index = scope.index - 1 scope.close = -> scope.enabled = false setupOverlay(false)