Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sidebar): nav link target doesn't work through appHtmlAttr #79

Merged
merged 2 commits into from
Oct 16, 2019
Merged

fix(sidebar): nav link target doesn't work through appHtmlAttr #79

merged 2 commits into from
Oct 16, 2019

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