【发布时间】:2019-05-16 19:10:02
【问题描述】:
我有一个 html 文件形式的日期选择器。提交表单后,我需要在我的 component.ts 文件中获取日期选择器的选定值
在 html 文件中:
<form (ngSubmit)="onSubmit(f)" #f="ngForm">
<input type="text" class="datepicker" ngModel id ="from" name="from" placeholder="From :">
</form>
in the component.ts file:
console.log(f.value.from);
我试过上面的代码,得到的值是未定义的。
【问题讨论】:
-
使用
stackoverflow.com/a/47572450/5724889