Link-to helper doesn't like class conditions
See original GitHub issueI am trying to use class conditions with a link-to helper, but fails on compilation.
link-to view.linkName lnid urlSlug itemprop="url" class={view.isSelected:selected view.icon}
doesnt work.
link-to view.linkName lnid urlSlug itemprop="url" class=view.isSelected:selected
doesnt work either.
a href="#" class={view.isSelected:selected view.icon}
works fine.
Issue Analytics
- State:
- Created 9 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Rails link_to_if Class Doesnt Display Correctly - Stack Overflow
The image displays, with no link as expected, but the CSS class defined at the end does not, instead it just has no...
Read more >link_to (ActionView::Helpers::UrlHelper) - APIdock
Creates an anchor element of the given name using a URL created by the set of options. See the valid options in the...
Read more >Problems parsing link-to with class names · Issue #282 · machty ...
Seems like adding an underscore in class name causes some misunderstanding in emblem's link parser. ... Link-to helper doesn't like class conditions #145....
Read more >Module ActionView::Helpers::UrlHelper - Rails API
Creates a link tag of the given name using a URL created by the set of options unless condition is true, in which...
Read more >Helpers - Zendesk Developer Docs
Displays a link to the page with the end user's activities. If signed in as an agent or Help Center manager, the link...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Inside mustache you need to use Ember’s inline if:
Some things to keep in mind:
{ }
are for wrapping things in mustache. In alink-to
you are already in a mustache context, so these won’t work.class
orclassNames
is very different thanclassNameBindings
. The inline approach should still work for the latter.I’m pretty sure the old colon syntax of
isActive:active:inactive
is not supported anymore by Ember.Actually, that latter case is expected. Components / helpers should be able to receive single arguments, and so without a
|
or a new-line there is no way to know when the helpers parameters end.@Leooo @kandebonfim could you confirm if the above examples work for you? Or is there a variation that is not working?
Thanks!