假设我有这个选择菜单和角度选项,如果我想添加某种与它们相关的数组,例如,如果有人选择 “Man Haircut”让客户端自动知道价格是10美元,持续时间是30分钟和某种描述。
<tr>
<td>Service</td>
<td><select type="text" ng-model="product.service"
ng-options="product.service.text for product.service in objectList track by product.service.Main Haircut">
<option value="Man Haircut">Man Haircut</option>
<option value="Woman Haircut">Woman Haircut</option>
<option value="Hair Dye">Hair Dye</option>
<option value="Abu Agela">Abu Agela</option>
</select>
</td>
</tr>
fullCalendar选择函数用于从日历中获取startTime
select: function(start, end) {
// Booking Form Toggle
if ($('#bookmenu').css('display') === "none") {
$('#bookmenu').show();}
// Fetching data from click event to booking form
$("#startdateID").val(moment().format(start));
},
我在这里想要实现的是根据用户根据开始日期选择的服务生成结束日期。
答案 0 :(得分:0)
<select ng-model='scope_product' ng-options='product as product.text for product in object_list'></select>
<script>
$scope.scope_product;
var object_list = [
{text: 'Man cut', price: 10.00, duration: 30},
{text: 'Woman cut', price: 20.00, duration: 1200}
]
// then you can access the selected option using $scope.scope_product
// so to get price $scope.scope_product.price
</script>