[@nativescript/datetimepicker] Form with date field in Angular

未关闭
#136 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
frontend, mobile

调研方向

从 issue 中的 DatePickerField Angular formControlName 示例开始,并将其行为与不使用 formControlName 的同一字段进行比较。重现当前日期绑定和与 picker 的交互;完成的标准是日期不再变为 1970 年 1 月 1 日或 1900 年 1 月 1 日,同时仍可在表单中使用。

由索引模型根据 Issue 内容生成。

描述

Hello,

I use formGroup to do my forms in my app so I used to define my form fields with formControlName like this :

<TextField formControlName="kilometers" keyboardType="number"></TextField>

But when I put it with the datePickerField, my date variable to set the current date doesn't work anymore and it puts 1 january 1970 and when I click on the field 1 january 1900.
As soon as I remove my formControlName value, it works without any issue, like if there was a conflict between date and formControlName :

<DatePickerField #date formControlName="date" [date]="dateRefuel" [pickerTitle]="'Refuel.DateTitle' | L" [maxDate]="dateRefuel"></DatePickerField>

Do you have any idea how to fix this ? The only solution that I found is to put the #date and extract the value when I click on my send form button.

Thanks

主要语言
TypeScript
星标
206
派生
123
平均合并
2 天 1 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NativeScript/plugins 的其他 Issue

查看 NativeScript/plugins 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。