diff --git a/packages/oui-header-tabs/README.md b/packages/oui-header-tabs/README.md
index 5ce82047..48098a2f 100644
--- a/packages/oui-header-tabs/README.md
+++ b/packages/oui-header-tabs/README.md
@@ -84,6 +84,19 @@
```
+
+### With action click
+
+```html:preview
+
+
+
+
+
+
+
+```
+
## API
### oui-header-tabs-item
@@ -97,6 +110,7 @@
| `active` | boolean | | no | `true`, `false` | `false` | manual active flag
| `disabled` | boolean | | yes | `true`, `false` | `false` | disabled flag
| `external` | boolean | | yes | `true`, `false` | `false` | external link flag
+| `on-click` | function | & | no | n/a | n/a | click handler
**Note**: `ui-router` is needed for the attributes `state` and `state-params`.
diff --git a/packages/oui-header-tabs/src/header-tabs-item.component.js b/packages/oui-header-tabs/src/header-tabs-item.component.js
index 5e14b3ab..af2cb028 100644
--- a/packages/oui-header-tabs/src/header-tabs-item.component.js
+++ b/packages/oui-header-tabs/src/header-tabs-item.component.js
@@ -11,6 +11,7 @@ export default {
stateParams: "",
external: "",
active: "",
- disabled: ""
+ disabled: "",
+ onClick: "&"
}
};
diff --git a/packages/oui-header-tabs/src/header-tabs-item.html b/packages/oui-header-tabs/src/header-tabs-item.html
index fa87aea6..ac1946e8 100644
--- a/packages/oui-header-tabs/src/header-tabs-item.html
+++ b/packages/oui-header-tabs/src/header-tabs-item.html
@@ -4,13 +4,15 @@
+ ng-if="!!$ctrl.href && !$ctrl.disabled"
+ ng-click="$ctrl.onClick()">
diff --git a/packages/oui-header-tabs/src/index.spec.js b/packages/oui-header-tabs/src/index.spec.js
index e74d02f5..311850e5 100644
--- a/packages/oui-header-tabs/src/index.spec.js
+++ b/packages/oui-header-tabs/src/index.spec.js
@@ -126,5 +126,21 @@ describe("ouiHeaderTabs", () => {
expect($separator.hasClass("oui-dropdown-menu__divider")).toBe(true);
expect($separator.attr("role")).toBe("separator");
});
+
+ it("should call function of onClick attribute, when header tab item is clicked", () => {
+ const clickSpy = jasmine.createSpy("spy");
+ const element = TestUtils.compileTemplate(`
+
+
+ `, {
+ clickHandler: clickSpy
+ }
+ );
+
+ const item = element[0].querySelector(".oui-header-tabs__item a");
+ angular.element(item).triggerHandler("click");
+ expect(clickSpy).toHaveBeenCalled();
+ expect(clickSpy.calls.count()).toEqual(1);
+ });
});
});