Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Accept hash function as an argument #21

Closed
axelhzf-tuguu opened this issue Dec 14, 2015 · 2 comments
Closed

Accept hash function as an argument #21

axelhzf-tuguu opened this issue Dec 14, 2015 · 2 comments
Assignees

Comments

@axelhzf-tuguu
Copy link

I'm having problems with the hash function and complex models

var options = [
{id: 1, comments: [1, 2, 3]},
{id: 2, comments: [4, 5, 6]}
];

var selected = {id : 1, comments: [3, 2, 1]}

The problems here is the order of the comments array. The hash function thinks they are different values.

I think a good solution could be a new parameter to pass the hash function. In my case the hash function should compare only by id

@pburgmer pburgmer self-assigned this Dec 14, 2015
pburgmer pushed a commit that referenced this issue Feb 3, 2016
… allow tracking of specific property instead of hole object

working examples:

* ```option.value as option.label for option in options.data track by option.value```
  default: track by 'value' part, same as without track by part
* ```option as option.label for option in options.data track by option.id```
  hole option item as value, id property for tracking
* ```option.value as option.label for option in options.data track by option.value.id```
  only value of option as value, id of value for tracking
* ```option as option.comments for option in options.data track by option.id```

non working examples:
* ```option.value as option.label for option in options.data track by option.id```
  tracking property is sibling to value, not the value itself neither a child

Closes #21
@pburgmer
Copy link
Collaborator

pburgmer commented Feb 3, 2016

I implemented it with the 'track by' syntax known from ngRepeat. Please see comment of e7db96e to see some examples

@pburgmer pburgmer closed this as completed Feb 3, 2016
@pburgmer
Copy link
Collaborator

Hi @axelhzf-tuguu ,

If you're using w11k-select and like it, please think about giving an 'I use it' at ngmodules.org
http://ngmodules.org/modules/w11k-select

Thanks & regards,
Philipp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants