码迷,mamicode.com
首页 > 其他好文 > 详细

ng-model 将时间戳转换为标准时间

时间:2017-08-04 19:36:07      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:for   ons   script   data   creat   不能   red   时间   $scope   

 

 html部分

<div class="form-group loginCon1">
    <label class="col-sm-2 control-label">创建时间 : </label>
    <div class="col-sm-10 createTime">
       <input ng-model="createTime" required id="createTime" name="createTime" type="text" class="form-control"/>
    </div>
</div>
<div class="form-group loginCon1">
  <label class="col-sm-2 control-label">更新时间 : </label>
  <div class="col-sm-10 updateTime">
     <input ng-model="updateTime" required id="updateTime" name="updateTime" type="text" class="form-control"/>
  </div>
 </div>

 

由于不能在input输入框中使用{{}},所以angular自带的时间过滤不能用,只能另想办法。

 $scope.createTime = $filter("date")(response.data.data.createTime, "yyyy-MM-dd HH:mm:ss");
 $scope.updateTime = $filter("date")(response.data.data.updateTime, "yyyy-MM-dd HH:mm:ss");

  

  

 

ng-model 将时间戳转换为标准时间

标签:for   ons   script   data   creat   不能   red   时间   $scope   

原文地址:http://www.cnblogs.com/WaTa/p/7286639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!