Skip to content

Yield computed properties in link-to component - #15835

Closed
sukima wants to merge 1 commit into
emberjs:masterfrom
sukima:patch-1
Closed

sukima wants to merge 1 commit into
emberjs:masterfrom
sukima:patch-1

Conversation

@sukima

@sukima sukima commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

This would allow greater flexibility and support for some CSS frameworks and situations where the link-to needs more than one element. For example:

{{#link-to "my-route" tagName="li" as |link|}}
  <a href={{link.href}} class="{{link.active}}">Link Title</a>
{{/link-to}}

Or even more complex ideas:

{{#link-to "my-route" tagName="li" as |link|}}
  {{#if link.active}}
    <span class="red">Current Route</span>
  {{else}}
    <a href={{link.href}}>Link Title</a>
  {{/if}}
{{/link-to}}

This would allow greater flexibility and support for some CSS frameworks and situations where the link-to needs more than one element. For example:

```hbs
{{#link-to "my-route" tagName="li" as |link|}}
  <a href={{link.href}} class="{{link.active}}">Link Title</a>
{{/link-to}}
```

Or even more complex ideas:

```hbs
{{#link-to "my-route" tagName="li" as |link|}}
  {{#if link.active}}
    <span class="red">Current Route</span>
  {{else}}
    <a href={{link.href}}>Link Title</a>
  {{/if}}
{{/link-to}}
```
@snewcomer

Copy link
Copy Markdown
Contributor

@sukima This is cool! I wonder if this could use a test in link-to-test.js? What do you think?

@locks

locks commented Nov 27, 2017

Copy link
Copy Markdown
Contributor

This introduces new public API, so it necessitates an RFC.

@sukima

sukima commented Dec 10, 2017

Copy link
Copy Markdown
Contributor Author

@mmun

mmun commented Feb 23, 2018

Copy link
Copy Markdown
Member

I'm closing this issue in light of emberjs/rfcs#275 (comment).

I still strongly encourage people to continue exploring this space in addons and in discussion issues on the RFC repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants