【发布时间】:2017-04-28 11:14:20
【问题描述】:
给定以下组件(使用选择器 my-template):
<form #theForm="ngForm">
<ng-content></ng-content>
</form>
并像这样使用它:
<my-template>
<input type="text" required name="firstName" [(ngModel)]="firstName"/>
</my-template>
表单始终有效 - 即使输入无效。如何使这项工作在输入无效时表单无效?
【问题讨论】:
标签: angular angular2-forms angular2-ngcontent