Ng模型值不会显示多个Angular Bootstrap UI日期时间选择器

时间:2017-11-24 03:09:25

标签: angularjs angular-ui-bootstrap

当我使用Datetime选择器进行单个输入时,它工作正常。

但是当我使用ng-repeat并且ng-model值没有显示在输入框内时,尽管ng-model值被正确保存。

请检查以下代码:

<div class="input-group">
   <span class="error-input" 
      ng-if="vm.editForm['employeeOnProjectStartDate'+$index].$error.required && vm.isSavedBefore">
   This field is required
   </span>                                                                
   <input type="text" class="form-control" required 
      name="employeeOnProjectStartDate{{$index}}"  
      enable-time="false" datetime-picker="dd-MMM-yyyy" ng-model="employee.employeeOnProjectStartDate"
      is-open="vm.datePickerOpenStatus.employeeOnProjectStartDate[$index]"  />
   <span class="input-group-btn">
   <button class="btn btn-default" ng-click="vm.openCalendar('employeeOnProjectStartDate',$index)">
   <i class="glyphicon glyphicon-calendar"></i>
   </button>
   </span>
</div>

1 个答案:

答案 0 :(得分:0)

the solution is to add ng-value as well. ng-value="employee.employeeOnProjectStartDate | date:'dd-MMM-yyyy'" solved the issue.