我有一个表格,用户需要选择两周的班次类型。我需要为每个单元格设置UNIQUE默认值,例如Day 1: D, Day2:N, etc.
。我怎样才能做到这一点?
您可以使用以下代码:
<select ng-model="day.selectedShiftType" ng-options="shift as shift.strId for shift in shifts" ng-init="day.selectedShiftType = shifts[0]">
上面将始终选择第一个选项,但是我们可以使用以下代码将其随机化: $scope.GetRandomIndex = function() { return Math.floor((Math.random()*3)+1); }
html代码:
<select ng-model="day.selectedShiftType" ng-options="shift as shift.strId for shift in shifts" ng-init="day.selectedShiftType = shifts[GetRandomIndex()]">
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句