Skip to content

Instantly share code, notes, and snippets.

@tkc
Created October 2, 2015 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkc/3706beeca4c1c8458d37 to your computer and use it in GitHub Desktop.
Save tkc/3706beeca4c1c8458d37 to your computer and use it in GitHub Desktop.
<div ng-controller="TestCtrl as test">
<select ng-model="test.selectedItem" ng-options="item as item.name for item in test.items"></select>
<pre>@{{test.selectedItem | json}}</pre>
</div>
app.controller('TestCtrl', function ($scope) {
this.items = [
{id: 1, name: 'foo'},
{id: 2, name: 'bar'},
{id: 3, name: 'blah'}
];
this.selectedItem = this.items[0];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment