Suppose i have the following array with strings:
$scope.open_slots = ["00","10","50"]
, and i would like to have the following results:
without doing this : $scope.open_slots = ["00 minutes","10 minutes","50 minutes"]
how can i just add suffix to each item in the select option list?
this is my code:
<select data-ng-model="minutes_per_slot" data-ng-options="item for item in open_slots"></select>
Suppose i have the following array with strings:
$scope.open_slots = ["00","10","50"]
, and i would like to have the following results:
without doing this : $scope.open_slots = ["00 minutes","10 minutes","50 minutes"]
how can i just add suffix to each item in the select option list?
this is my code:
<select data-ng-model="minutes_per_slot" data-ng-options="item for item in open_slots"></select>
Share
Improve this question
asked Aug 7, 2014 at 8:24
Liad LivnatLiad Livnat
7,47517 gold badges61 silver badges98 bronze badges
2 Answers
Reset to default 11You can do it using the as
part of the ngOptions
:
ng-options="slot as slot+' minutes' for slot in open_slots">
See, also, this short demo.
Try:
<select data-ng-model="minutes_per_slot"
data-ng-options="item as item + ' minutes' for item in open_slots">