Luja Shrestha
Luja Shrestha

Reputation: 2877

ng-options track by issue

There is a select dropdown

 <select ng-model="filter_cli" ng-options=" gc.id as gc.name for gc in
 businesses | filter :{type : 'CLIENT'} track by gc.id">

When Selecting in the app, the selected value is not being displayed but is being assigned. Removing "track by" solves the issue but then the value of the options needs to be the id of the object.

Upvotes: 0

Views: 43

Answers (1)

dave
dave

Reputation: 64707

I think you just need to move your track by to before your filter:

<select ng-model="filter_cli" ng-options=" gc.id as gc.name for gc in
businesses track by gc.id | filter :{type : 'CLIENT'}">

Upvotes: 1

Related Questions