Skip to content

Commit 2e025c8

Browse files
authored
feat(navbar): add external option to navbar link (#739)
Signed-off-by: varun257 <[email protected]>
1 parent eec4112 commit 2e025c8

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

packages/components/navbar/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,4 @@ The property `name` **must be** `"user"`.
357357
| `state-params` | object | <? | yes | n/a | n/a | state-params of the link
358358
| `variant` | string | @? | yes | `primary`, `secondary`, `tertiary` | n/a | style modifier of the link
359359
| `on-click` | function | & | no | n/a | n/a | click callback
360+
| `external` | boolean | & | yes | n/a | n/a | flag for external

packages/components/navbar/src/js/link/navbar-link.component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default {
1313
label: '@?ariaLabel',
1414
variant: '@?',
1515
onClick: '&',
16+
external: '<?',
1617
},
1718
controller,
1819
template,

packages/components/navbar/src/js/link/navbar-link.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
}"
1111
ng-href="{{::$ctrl.href}}"
1212
ng-click="$ctrl.onClick()"
13-
ng-transclude>
13+
ng-attr-rel="{{:: $ctrl.external ? 'noopener' : undefined }}"
14+
ng-attr-target="{{::$ctrl.external ? '_blank' : null}}">
15+
<span ng-transclude></span>
1416
</a>
1517
<a class="oui-navbar-link"
1618
ng-if="::!!$ctrl.state"

0 commit comments

Comments
 (0)