Javascript Angular 2模型驱动窗体中的默认无效选择选项?

Javascript Angular 2模型驱动窗体中的默认无效选择选项?,javascript,angular,angular2-forms,Javascript,Angular,Angular2 Forms,在Angular 2模型驱动的表单中,是否有任何方法可以实现无效的默认选择选项 我在找这样的东西: <select name="DateExpiryMonth" [(ngModel)]="model.DateExpiryMonth" ngControl="dateExpiryMonth" required> <option value="" selected="selected" disabled>Month...</option> <o

在Angular 2模型驱动的表单中,是否有任何方法可以实现无效的默认选择选项

我在找这样的东西:

<select name="DateExpiryMonth" [(ngModel)]="model.DateExpiryMonth" ngControl="dateExpiryMonth" required>
    <option value="" selected="selected" disabled>Month...</option>
    <option *ngFor="let month of months" [value]="month">{{ month }}</option>
</select>

月。。。
{{month}
理想情况下,select上的
required
属性将确保Angular 2认为第一个
无效,但我找不到任何文档表明这是可能的


如前所述,第一个“月份…”选项被认为是有效的2角。

< P>我不认为这是一个理想的解决方案,但是我发现如果我把模型中的字段设置为空或未定义(在你的例子中是“代码>模型。DATEXEVYYONE < /COD> >”),这个角度会考虑窗体无效。