Skip to content

Commit 9508d50

Browse files
committed
refactor(SidebarNavLink): add item.href for explicit external links
1 parent fd72261 commit 9508d50

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</a>
1010
<a *ngSwitchCase="'external'"
1111
[ngClass]="getLinkClass()"
12-
[href]="item.url"
12+
[href]="href"
1313
[appHtmlAttr]="item.attributes"
1414
>
1515
<i *ngIf="helper.hasIcon(item)" [ngClass]="item | appSidebarNavIcon"></i>

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AppSidebarNavLinkComponent implements OnInit {
2222

2323
ngOnInit() {
2424
this.linkType = this.getLinkType();
25-
this.href = this.isDisabled() ? '' : this.item.url;
25+
this.href = this.isDisabled() ? '' : (this.item.href || this.item.url);
2626
}
2727

2828
public getLinkClass() {
@@ -49,7 +49,7 @@ export class AppSidebarNavLinkComponent implements OnInit {
4949
}
5050

5151
public isExternalLink() {
52-
return this.item.url.substring(0, 4) === 'http';
52+
return !!this.item.href || this.item.url.substring(0, 4) === 'http';
5353
}
5454

5555
public hideMobile() {

0 commit comments

Comments
 (0)