I need to update datetimepicker[i]
script inside ng-repeat
but I do not know how to do that.
<div class='input-group date' id='datetimepicker{{$index+1}}'>
work successfully and made list of
<div class='input-group date' id='datetimepicker1'>
<div class='input-group date' id='datetimepicker2'>
but problem is script not update from model data
$('#datetimepicker{{$index+1}}').datetimepicker();
result is
$('#datetimepicker{{$index+1}}').datetimepicker();
I want to '#datetimepicker{{$index+1}}'
change to'#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>
Update
I move my code inside controller and make html in controller
Controller - MVC
onlineResult.dateHtml = @"<script type=""text/javascript"">$(function () {$('#datetimepicker"+(i + 1).ToString()+ "').datetimepicker({format: 'YYYY/MM/DD HH:mm:ss'});});</script>";
and update view to
<p compile data-ng-bind-html="to_trusted(row.dateHtml)"></p>
My new problem is model bind in Get
but not changed in Post
.
When i submit form my Get
data sent to controller not changed data