Skip to content

Instantly share code, notes, and snippets.

@nickcherry
Last active April 26, 2017 00:00
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 nickcherry/30f773265db349c93049 to your computer and use it in GitHub Desktop.
Save nickcherry/30f773265db349c93049 to your computer and use it in GitHub Desktop.
custom-angular-select (array of objects)
angular.module 'angular-custom-select-examples', ['angular-custom-select']
.controller 'ExamplesController', ($scope) ->
$scope.selectedValues = {}
$scope.objects = [
{ name: 'Option A' }
, { name: 'Option B' }
, { name: 'Option C' }
, { name: 'Option D (disabled)', disabled: true }
, { name: 'Option E' }
]
<custom-select
ng-model="selectedValues.object"
ng-options="object as object.name for object in objects"
placeholder="Select one of these object values..."
disabled-attribute="disabled">
</custom-select>
<div class="selected-value">
Selected Value: {{ selectedValues.object || 'N/A' }}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment