简体   繁体   English

角日期过滤器不适用于双向数据绑定

[英]Angular date filter not working with two-way data binding

I have the following code: 我有以下代码:

<input type="date" name="dat" ng-model="dat" placeholder="date">
<h3>Date: {{dat | date:'fullDate'}}</h3>
{{1288323623006 | date:'fullDate'}}

The first interpolation shows nothing no matter what I type in the input element, but the second interpolation displays the date as it should. 无论我在输入元素中键入什么内容,第一个插值均不显示任何内容,但是第二个插值将按原样显示日期。 I'm using angular 1.4.5 and I don't have this problem when I use angular 1.2.x. 我正在使用角度1.4.5,使用角度1.2.x时没有此问题。 I'm guessing I missed some update regarding the date filter, but I can't seem to find any mention of this on google. 我猜想我错过了有关日期过滤器的一些更新,但是我似乎在Google上找不到任何提及。

I also don't have this problem (even with angular 1.4.5) when I change the type of input element to number. 当我将输入元素的类型更改为数字时,我也没有这个问题(即使是角度为1.4.5)。

I was a bit hasty to post my question. 我有点急于发表我的问题。 The thing that I didn't realize was that from version 1.3 the validator is no longer a part of the parser/formatter pipeline and since I'm entering numbers and not valid dates the model is never updated. 我没有意识到的是,从1.3版开始,验证器不再是解析器/格式器管道的一部分,并且由于我输入的是数字而不是有效日期,因此该模型永远不会更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM