using trackby on object
See original GitHub issueAPI response returns an object with nested attributes for each option. How can I tell track-by
to use an object property? i.e. track-by="attributes.language"
Example here: https://jsfiddle.net/fy18zy9b/3/
<multiselect
v-model="value"
:options="options"
:multiple="true"
track-by="attributes.language"
:custom-label="customLabel"
>
</multiselect>
Sample options:
[
{
attributes:
{
language : 'JavaScript',
library: 'Vue.js'
}
},
{
attributes:
{
language : 'JavaScript',
library: 'Vue-Multiselect'
}
},
{
attributes:
{
language : 'JavaScript',
library: 'Vuelidate'
}
},
]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:5
Top Results From Across the Web
How to use `trackBy` with `ngFor` - angular - Stack Overflow
Based on some examples I've seen on the web, I should return the value of some property on the object. Is it right?...
Read more >When, Why and How to Use Trackby - DLT Labs - Medium
It's a core directive that comes with Angular framework itself. It makes it easy to iterate over something like an array or an...
Read more >Angular Basics: Track Incoming Data With TrackBy Method
TrackBy is a directive that can work with ngFor to identify items in a list of DOM elements like a list or array...
Read more >How to use trackBy in Angular with Example - Codebriefly
The trackBy function takes two arguments, the first is the index and the second one is the current item. That will return one...
Read more >Explain ngFor trackBy in Angular - Simple Talk
At the; end of this blog, you will understand how to use ngFor trackBy and when to use the ngFor trackBy in your...
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 Free
Top 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
+1
Would be great to have any prop ‘customTrackBy’ (Function => String) like ‘customLabel’ so as to work with any nested object
+1