angularjs <input>标签获取时间显示问题

 一般的后台管理中,几乎每个管理后台都有设置新密码的功能,但是获取的时候为了好看,都有统一用一定的标签,比如input标签,ng-model来控制显示数据,但是在获取时间的时候用会显示错乱

代码为:

<input type="text" ng-model="currentCom.createTime" style=" 260px;"  timeFormat="HH:mm:ss" disabled/>

也改用了其他人分享经验中所给出的方案。

比如:

1、<input type="text" disabled="" style=" 260px;" data-date-formats="yyyy-MM-dd hh:mm:ss" />

2、<input type="text" ng-model="currentCom.createTime" style=" 260px;" format="yyyy-MM-dd HH:mm:ss"  disabled/>
但是还是依旧出现如下的错误

后面想了想ng-model是控制显示数据,那我是否可以用别的元素来替换ng-model呢?后面去查了一些官网的api给出an-value的介绍。

It can also be used to achieve one-way binding of a given expression to an input element such as an input[text] or a textarea, when that element does not use ngModel.

之后改换了控制显示数据的元素:

<input type="text" ng-value="currentCom.createTime|date:'yyyy/MM/dd HH:mm:ss'" style=" 260px;" disabled/>

原文地址:https://www.cnblogs.com/liziyou/p/6472069.html