-
Notifications
You must be signed in to change notification settings - Fork 12
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
External Links #290
Comments
Don't make this assumption, please :) |
Sure! I definitely wasn't implying that this should be the default behavior. I only meant that it should be possible to pass something like |
We can do something like an External Link: Any link/url not recognizable by the ember router. Instance-specific: <div {{external-link this.handleExternalLink}}>
<a href="https://emberjs.com">Go to ember</a>
</div> And Or register this globally: // app/application/route.ts
export default class ApplicationRoute extends Route {
beforeModel() {
this.externalLinkService.setHandler(this.handleExternalLinkGlobal);
}
@action
handleExternalLinkGlobal() {
// so sth here
}
} And use it like this: <div {{external-link}}>
<a href="https://emberjs.com">Go to ember</a>
</div> If there is no handler given as first argument to the modifier or no global handler... then the eeeek. would work nicely with the <NavigationMenu {{external-link this.openInNewTab}}
@navItems={{array
(hash label="Top Sellers" link=(link "top"))
(hash label="Categories" link=(link "categories"))
(hash label="Shopping Cart" link=(link "cart"))
(hash label="Legal" link=(external-link "/legal"))
}}
/> |
This makes no sense when used directly in the template, like:
However, it becomes very useful when passing
Link
s around, e.g. to build a navigation menu, because you can then easily use the same primitive in a common code path:I'm not sure about the exact API yet.
Another thing: Usually you'll want external links to open in a new tab. This should not need to be defined at the "call site" where the
Link
is used on an<a>
element, but rather where theLink
is defined.Something like this maybe? #289
The text was updated successfully, but these errors were encountered: