[英]Get time difference without $watches
I have a fixed table with a fixed number of rows. 我有一个固定的表,具有固定的行数。 Lots of rows of timepicker input boxes and it would be great if I could update the total input's model by calculating the difference every time one of the inputs are changed, into a format HH:SS.
时间选择器输入框的行很多,如果我可以通过在每次输入之一更改时将其差值计算为HH:SS格式来更新总输入模型,那就太好了。 The timepicker writes date objects to the model.
时间选择器将日期对象写入模型。
How could I possibly do this? 我怎么可能这样做?
<tr>
<th scope="row">Sun</th>
<td><input class="shift-hours" type="text" ng-model="sform.shift_defaults.day.sun.total" /></td>
<td><input class="shift-timepicker" ui-timepicker ng-model="sform.shift_defaults.day.sun.on" /></td>
<td><input class="shift-timepicker" ui-timepicker ng-model="sform.shift_defaults.day.sun.off" /></td>
</tr>
<tr>
<th scope="row">Mon</th>
<td><input class="shift-hours" type="text" ng-model="sform.shift_defaults.day.mon.total"/></td>
<td><input class="shift-timepicker" ui-timepicker ng-model="sform.shift_defaults.day.mon.on"/></td>
<td><input class="shift-timepicker" ui-timepicker ng-model="sform.shift_defaults.day.mon.off"/></td>
</tr>
you could write smth like 你可以这样写
<span ng-bind="calculate(model1, model2, model3)"/>
and define calculation for multiple models in calculate function. 并在计算功能中定义多个模型的计算。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.