Skip to content

Conversation

Hagith
Copy link
Contributor

@Hagith Hagith commented Oct 5, 2019

No description provided.

Copy link
Member

@xidedix xidedix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The target attribute for an external link works as expected. There is no need to add line 6.

@xidedix
Copy link
Member

xidedix commented Oct 7, 2019

Hi @Hagith
Thanks for the heads-up and PR.
We'll investigate the router link issue.

@xidedix
Copy link
Member

xidedix commented Oct 7, 2019

The router swaps components in the router-outlet existing within the running application. It's not shared across multiple windows. Retargeting a link into another window requires re-bootstrapping of the entire application. The same can be achieved using a html link.

@xidedix xidedix closed this Oct 7, 2019
@Hagith
Copy link
Contributor Author

Hagith commented Oct 7, 2019

Yes, your'e right. But it's bit difficult to force coreui to render html link (*ngSwitchCase="'external'"). This is automatically computed in isExternalLink() as this.item.url.substring(0, 4) === 'http'.
This forces to build full URL with current protocol, domain and baseHref configured in angular.json.
What about extending isExternalLink() to:
this.item.url.substring(0, 4) === 'http' || (this.item.attributes && this.item.attributes.target)?

@Hagith
Copy link
Contributor Author

Hagith commented Oct 7, 2019

I just checked that extending isExternalLink() is not sufficient. It will not take baseHref into account, so our "forced" external link will be broken.

@xidedix xidedix reopened this Oct 7, 2019
@Hagith
Copy link
Contributor Author

Hagith commented Oct 7, 2019

  • The target attribute for an external link works as expected. There is no need to add line 6.

Your'e right, removed.

@xidedix xidedix merged commit 7fb6821 into coreui:master Oct 16, 2019
@Hagith Hagith deleted the sidebar-nav-link-target-attr branch October 16, 2019 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants