【问题标题】:How to get value of input type=month in angular如何以角度获取输入类型=月份的值
【发布时间】:2019-11-11 10:19:03
【问题描述】:
<input value="2019-10" type="month">

如何以角度获取该输入字段的值以及如何动态更改输入字段的值??

【问题讨论】:

标签: angular input monthcalendar


【解决方案1】:

使用角度数据绑定。

<input type="month" [(ngModel)]="myVariable">

这个 myVariable 你可以在输入改变时给出起始值并获取改变值。

【讨论】:

  • 您能告诉我如何在 .ts 文件中进行操作吗?
  • 在 .ts 文件中声明 myVariable。此变量将包含所需的值。
  • 当我在我的 .html 文件代码中添加 [(ngModel)] = "myVariable" 时,url 停止打开
  • 您可能需要在 app.module 中导入 formsModule。 (在 imports 数组中)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-03
  • 1970-01-01
  • 2021-03-23
  • 2023-03-02
相关资源
最近更新 更多