Reputation: 3789
Is there a way to pass a hash from a model as the query params to the link-to helper?
For example, I have a model:
export default DS.Model.extend({
val1: DS.attr('string'),
val2: DS.attr('string'),
asHash: Ember.computed('val1', 'val2', function() {
'val1': this.get('val1'),
'val2': this.get('val2'),
})
});
And in a component I want to use that value like:
<div>
{{#link-to 'query-page' (query-params model.asHash)}}query{{/link-to}}
</div>
The example above results in an error:
Uncaught Error: Assertion Failed: The query-params
helper only accepts hash parameters, e.g. (query-params queryParamPropertyName='foo') as opposed to just (query-params 'foo')
Any ideas on how this can be worked around?
Upvotes: 0
Views: 529
Reputation: 3207
I don't think it is possible, (query-params)
needs property name for query value you are passing queryParamPropertyName='foo'
, instead of passing model as queryparam you can pass it directly link-to
{{#link-to 'my-route' model }}query{{/link-to}}
but my-route
should support it.
Upvotes: 1