Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Can I add a custom helper to a {{link-to}} component?

$
0
0

@sorvah wrote:

I have a couple of places in my application where I add some query-params to a {{link-to}} helper. They have gotten quite unwieldy and ‘hardcoded’ for example:

{{#link-to 'custSearch.results' (query-params dateFrom=dateFrom dateTo=dateTo listType=0
    coc=null dest=null conID=null spec=null apptWithin=null tlSource=c1source deleted=null hours=hours period=period grade=model.name_id)}}

This might be used a few times on a single page so I thought I would create a helper that made all of the params null unless I passed in the desired namedArgs.

I created the helper but I can’t seem to add it without generating an error. For example I have tried:

{{#link-to 'custSearch.results'  {{helper dateFrom=dateFrom}} }}

and

{{#link-to 'custSearch.results' (helper dateFrom=dateFrom)}}

however both create errors and stop the page from loading. I have used custom helpers elsewhere by just using {{helpername}} but that was in the template, not in another component.

Am I barking up the wrong tree?

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles