【发布时间】:2021-10-18 08:56:11
【问题描述】:
我根据这个在我的表单中设置了日期选择器: https://bootstrap-datepicker.readthedocs.io/en/latest/
<div class="input-group date" data-provide="datepicker" >
<input type="text" class="form-control">
<div class="input-group-addon" >
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
如何将其添加到ngModel?
以与我对其他输入(如文本、收音机)相同的方式绑定它。
<input type="text" class="form-control" name="mytext" ngModel> <-- works
<div class="input-group date" data-provide="datepicker" >
<input type="text" class="form-control" name="mydate" ngModel> <-- doesnt work
<div class="input-group-addon" >
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
如您所见,我想以与其他输入完全相同的方式绑定它。component.ts 知道 mydate 的新字段,但它仍然为空。
【问题讨论】:
-
这是一篇关于它的文章.. itsolutionstuff.com/post/…
标签: angular bootstrap-4 datepicker