0

In ui-select-choices repeat="type in (types| filter: $select.search) track by type.name. In track by type.name part, given the name is NOT a key. I tried adding two exactly the same data (different key). Error reference

Why is it returning a duplicate error? Why not ui-select just display the two duplicated data since they have different key? Any technical explanation for this?

5
  • It's not like that. I already know what's the cause of error. I just wan't to know why is that an error. Something like that Commented Nov 23, 2016 at 7:53
  • ur traking by name .....may be two types contains same name so try with traking by some unique field like id Commented Nov 23, 2016 at 8:02
  • That's my question, why is it a duplicate error when it's not a key? Commented Nov 23, 2016 at 8:03
  • 1
    simply your error message saying it all....there is dup's in repeater.....so its saying to Use 'track by' expression to specify unique keys.....here you gave name as unique but actually its not so its saying given the name is NOT a key. Commented Nov 23, 2016 at 8:09
  • Ohhwww. That sums it all. Thank you! cleared mind here Commented Nov 23, 2016 at 8:13

1 Answer 1

0

Occurs if there are duplicate keys in an ngRepeat expression. Duplicate keys are banned because AngularJS uses keys to associate DOM nodes with items.

From : https://docs.angularjs.org/error/ngRepeat/dupes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.