Skip to content

Commit 7635f3e

Browse files
Merge pull request #331 from dgutride/fix-wizard-buttons
Wrap wizard button in an IIFE to prevent access globally.
2 parents df5af8b + a5906f0 commit 7635f3e

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/wizard/wizard-buttons.js

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
function wizardButtonDirective (action) {
1+
(function () {
22
'use strict';
3-
4-
angular.module('patternfly.wizard')
5-
.directive(action, function () {
6-
return {
7-
restrict: 'A',
8-
require: '^pf-wizard',
9-
scope: {
10-
callback: "=?"
11-
},
12-
link: function ($scope, $element, $attrs, wizard) {
13-
$element.on("click", function (e) {
14-
e.preventDefault();
15-
$scope.$apply(function () {
16-
// scope apply in button module
17-
$scope.$eval($attrs[action]);
18-
wizard[action.replace("pfWiz", "").toLowerCase()]($scope.callback);
3+
function pfWizardButtonDirective (action) {
4+
angular.module('patternfly.wizard')
5+
.directive(action, function () {
6+
return {
7+
restrict: 'A',
8+
require: '^pf-wizard',
9+
scope: {
10+
callback: "=?"
11+
},
12+
link: function ($scope, $element, $attrs, wizard) {
13+
$element.on("click", function (e) {
14+
e.preventDefault();
15+
$scope.$apply(function () {
16+
// scope apply in button module
17+
$scope.$eval($attrs[action]);
18+
wizard[action.replace("pfWiz", "").toLowerCase()]($scope.callback);
19+
});
1920
});
20-
});
21-
}
22-
};
23-
});
24-
}
21+
}
22+
};
23+
});
24+
}
2525

26-
wizardButtonDirective('pfWizNext');
27-
wizardButtonDirective('pfWizPrevious');
28-
wizardButtonDirective('pfWizFinish');
29-
wizardButtonDirective('pfWizCancel');
30-
wizardButtonDirective('pfWizReset');
26+
pfWizardButtonDirective('pfWizNext');
27+
pfWizardButtonDirective('pfWizPrevious');
28+
pfWizardButtonDirective('pfWizFinish');
29+
pfWizardButtonDirective('pfWizCancel');
30+
pfWizardButtonDirective('pfWizReset');
31+
})();

0 commit comments

Comments
 (0)