aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngResource
diff options
context:
space:
mode:
authorquazzie2013-05-14 19:56:11 +0100
committerPete Bacon Darwin2013-05-14 19:58:05 +0100
commitc32a859bdb93699cc080f9affed4bcff63005a64 (patch)
tree19dbc20c08ac85d0c9878eaab8ac479d57affe37 /src/ngResource
parent4acc28a310d006c62afe0de8ec82fed21c98c2d6 (diff)
downloadangular.js-c32a859bdb93699cc080f9affed4bcff63005a64.tar.bz2
feat(select): match options by expression other than object identity
Extend ng-options with a new clause, "track by [trackByExpression]", which can be used when working with objects. The `trackByExpression` should uniquely identify select options objects. This solves the problem of previously having to match ng-options objects by identity. You can now write: `ng-options="obj as obj.name for obj in objects track by obj.id"` The "track by" expression will be used when checking for equality of objects. Examples: <select ng-model="user.favMovieStub" ng-options="movie as movie.name for movie in movies track by movie.id"> </select> scope: { user: { name: 'Test user', favMovieStub: { id: 1, name: 'Starwars' } } movies: [{ id: 1, name: 'Starwars', rating: 5, ... }, { id: 13, ... }] } The select input will match user favMovieStub to the first movie in the movies array, and show "Star Wars" as the selected item.
Diffstat (limited to 'src/ngResource')
0 files changed, 0 insertions, 0 deletions