ng-options add suffix to each option

后端 未结 2 1186
借酒劲吻你
借酒劲吻你 2021-01-21 01:59

Suppose i have the following array with strings:

$scope.open_slots = [\"00\",\"10\",\"50\"], and i would like to have the following results:

相关标签:
2条回答
  • 2021-01-21 02:16

    You 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.

    0 讨论(0)
  • 2021-01-21 02:29

    Try:

    <select data-ng-model="minutes_per_slot" 
            data-ng-options="item as item + ' minutes' for item in open_slots">
    
    0 讨论(0)
提交回复
热议问题