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.
|
||
|---|---|---|
| css | ||
| docs | ||
| example | ||
| i18n | ||
| images | ||
| lib | ||
| logs | ||
| src | ||
| test | ||
| .gitignore | ||
| .travis.yml | ||
| angularFiles.js | ||
| changelog.js | ||
| CHANGELOG.md | ||
| changelog.spec.js | ||
| changelog.tmp.md | ||
| check-size.sh | ||
| CONTRIBUTING.md | ||
| gdocs.js | ||
| gen_docs.sh | ||
| Gruntfile.js | ||
| init-repo.sh | ||
| karma-e2e.conf.js | ||
| karma-jqlite.conf.js | ||
| karma-jquery.conf.js | ||
| karma-modules.conf.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| release-commit.sh | ||
| start-iteration.sh | ||
| validate-commit-msg.js | ||
| validate-commit-msg.spec.js | ||
| version.js | ||
| version.yaml | ||
| watchr-docs.rb | ||
AngularJS
AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you use good old HTML (or HAML, Jade and friends!) as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. It automatically synchronizes data from your UI (view) with your JavaScript objects (model) through 2-way data binding. To help you structure your application better and make it easy to test, AngularJS teaches the browser how to do dependency injection and inversion of control. Oh yeah and it also helps with server-side communication, taming async callbacks with promises and deferreds; and make client-side navigation and deeplinking with hashbang urls or HTML5 pushState a piece of cake. The best of all: it makes development fun!
- Web site: http://angularjs.org
- Tutorial: http://docs.angularjs.org/tutorial
- API Docs: http://docs.angularjs.org/api
- Developer Guide: http://docs.angularjs.org/guide
- Contribution guidelines: http://docs.angularjs.org/misc/contribute
Building AngularJS
Once you have your environment setup just run:
grunt package
Running Tests
To execute all unit tests, use:
grunt test:unit
To execute end-to-end (e2e) tests, use:
grunt package
grunt test:e2e
To learn more about the grunt tasks, run grunt --help and also read our
contribution guidelines.