Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have a dynamic linkTo title attribute?

Tags:

ember.js

{{#linkTo "route" model title=model.title}}model.title{{/linkTo}}

This gives the resulting a tag a title value of "model.title". I want to iterate a list of models and output a link with a unique title for each.

Can this be done?

like image 454
Brenden Avatar asked Feb 15 '23 16:02

Brenden


1 Answers

Based on @guleria's comment and for the sake of having this question answered I'll provide an answer.

{{#linkTo "route" model titleBinding=model.title}}model.title{{/linkTo}}

Providing Binding as a suffix to your properties will enable bindings. As for where this is documented, here an extract of the documentation:

Properties ending in a Binding suffix will be converted to Ember.Binding instances. The value of this property should be a string representing a path to another object or a custom binding instanced created using Binding helpers.

Hope it helps.

like image 84
intuitivepixel Avatar answered Mar 11 '23 08:03

intuitivepixel