我需要在datetimepicker[i]
内更新ng-repeat
脚本,但我不知道该怎么做。
<div class='input-group date' id='datetimepicker{{$index+1}}'>
成功完成并列出了
<div class='input-group date' id='datetimepicker1'>
<div class='input-group date' id='datetimepicker2'>
但问题是脚本没有从模型数据更新
$('#datetimepicker{{$index+1}}').datetimepicker();
结果是
$('#datetimepicker{{$index+1}}').datetimepicker();
我希望'#datetimepicker{{$index+1}}'
更改为'#datetimepicker1'
<tr data-ng-repeat="row in game.result">
<td>{{$index+1}}</td>
<td ng-bind="row.host"></td>
@*<td>
<input class="form-control text-center" data-ng-model="row.dateStart" />
</td>*@
<td ng-controller="DatepickerDemoCtrl">
<div class="input-group w-360">
<div class='input-group date' id='datetimepicker{{$index+1}}'>
<input data-format="yyyy/MM/dd hh:mm:ss" ng-model="row.dateStart" type='text' class="form-control" ng-required="true" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker{{$index+1}}').datetimepicker();
});
</script>
</div>
</td>
<td>
<select ng-model="row.gameState"
ng-options="c.Value as c.Text for c in game.states" class="form-control" required></select>
</td>
<td>
<input class="form-control text-center" data-ng-model="row.hostGoals" type="number" required />
</td>
<td>
<input class="form-control text-center" data-ng-model="row.guestGoals" type="number" required />
</td>
<td ng-bind="row.guest"></td>
</tr>
我在控制器中移动代码并在控制器中生成html
控制器 - MVC
onlineResult.dateHtml = @"<script type=""text/javascript"">$(function () {$('#datetimepicker"+(i + 1).ToString()+ "').datetimepicker({format: 'YYYY/MM/DD HH:mm:ss'});});</script>";
并将视图更新为
<p compile data-ng-bind-html="to_trusted(row.dateHtml)"></p>
我的新问题是Get
中的模型绑定,但Post
中没有更改。
当我提交表单时,发送给控制器的Get
数据未更改数据
答案 0 :(得分:0)
我使用了angularjs指令datetimepicker