遇到ng-bind和datepicker问题 [英] Having issue with ng-bind and datepicker

查看:119
本文介绍了遇到ng-bind和datepicker问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据字段是StartDate。通过Json格式的ajax调用从服务器检索数据。 StartDate为JSON日期/日期(1453356000000)/。



使用ng-bind进行文本框ID绑定,如下所示。



Data field is StartDate. Data is retrieved from server via ajax call in Json format. StartDate comes as JSON date /Date(1453356000000)/.

A textbox id bind using ng-bind as below.

<input type="text" ng-model="di.StartDate | JSONdate | date: 'dd-MMM-yyyy'" required placeholder="dd-MMM-yyyy" data-dateformat="dd-M-yy" datepicker />





日期显示为2016年1月21日预期。



现在,当我单击文本框更改日期时,datepicker弹出窗口。我选择了一个新的日期。



现在问题出现在JSON对象(di)中,创建了一个新的属性/属性以及原始的StartDate属性/属性。





Date is displayed as "21-Jan-2016" expected.

Now when I click the textbox to change the date, datepicker popups. I select a new date.

Now the problem is in the JSON object (di) an new attribute/property is created along with the original "StartDate" attribute/property.

StartDate : '/Date(1453356000000)/'
StartDate | JSONdate | date: 'dd-MMM-yyyy' : '12-Jan-2016'





请帮助。



Please help.

推荐答案

问题可能是由于使用了两种不同的日期格式。尝试以类似的格式获取数据。在将数据分配给模型之前处理javascript中的数据或尝试设置类似于从服务器获取的日期格式的日历日期格式。如果你能在plunker上这样做,我可以更好地帮助你。
Problem might be because of two different date format used. Try getting the data in similar format. Either process the data in javascript before assigning it to model or try setting the calendar date format similar to date format you fetch from server. If you can this on plunker i can help you in better way.


这篇关于遇到ng-bind和datepicker问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆