我正在尝试使用ng2-datepicker,但是我没有从input元素得到触摸到的响应。datepicker-input被标记为已触摸,但它不会反弹到Angular。
<ng2-datepicker class="form-control ng-untouched ng-pristine ng-invalid" formcontrolname="datefound" _nghost-lur-40="" ng-reflect-name="datefound">
<div _ngcontent-lur-40="" class="datepicker-container u-is-unselectable">
<div _ngcontent-lur-40="" class="datepicker-input-container">
<input _ngcontent-lur-40="" class="datepicker-input ng-untouched ng-pristine ng-valid" type="text">
<div _ngcontent-lur-40="" class="datepicker-input-icon">
<i _ngcontent-lur-40="" class="ion-ios-calendar-outline"></i>
</div>
</div>
<!--template bindings={
"ng-reflect-ng-if": null
}-->
</div>
</ng2-datepicker>
在Angular 2中有没有一种方法可以获取datepicker-input并附加onTouchedCallback操作?我不想修改ng2-datepicker模块,所以我想从父模块中完成所有代码。
我可以做类似下面的事情吗:- form.get('datefound')('.datepicker-input').touched
发布于 2017-01-31 12:29:03
然而,这不是最好的答案!为了解决这个问题,我更新了模块本身(我不想做的事情),添加了以下内容:

这触发了所需的操作,然后使我能够正确地进行验证。
这不是我最初想要的,但这是我目前的解决方案。
https://stackoverflow.com/questions/41932860
复制相似问题