javascript - Ng-options to show name but record id -
i have model, $scope.beer
, , want user able select list of breweries ($scope.breweries
) beer belongs. however, want display names of beer have model record id of brewery can reference in database.
so far have this:
<select name="brewery" ng-model="beer.brewery" ng-options="breweries.id breweries.name brew in breweries"></select>
however, <options>
element printing undefined name. using ng-options
incorrectly?
you should modify ngoptions part use brew.id
, brew.name
:
ng-options="brew.id brew.name brew in breweries"
since have brew
iteration item.
Comments
Post a Comment