有问题的案例:日期和时间。我的表单有2个单独的#unlink /etc/alternatives/java
#ln -s <new location> /etc/alternatives/java
字段,input
(打开日期选择器)和date
(打开时钟选择器),
timeOfDay
和
<div class="form-group date-and-time">
<div class="my-datepicker md-form-control">
<md-input readOnly type="text" placeholder="Date" myDatePicker formControlName="date">
</md-input>
<small *ngIf="!form.controls.date.valid && submitted" class="ui error-message">
Invalid date.
</small>
</div>
<div class="my-clockpicker md-form-control">
<md-input readOnly type="text" placeholder="Time" myClockPicker formControlName="timeOfDay">
<span md-suffix>'Clock</span>
</md-input>
<small *ngIf="!form.controls.timeOfDay.valid && submitted" class="ui error-message">
Invalid time.
</small>
</div>
</div>
我需要确保用户无法输入将来的日期和时间,但我一次只能验证一个输入,这当然不会起作用。我该怎么做?
答案 0 :(得分:2)
您可以创建一个自定义验证器,它将接受另一个控件作为输入。像这样:
<UWPToolkit:AdaptiveGridView x:Name="AdaptiveGV" ItemHeight="200" ItemClick="AdaptiveGV_ItemClick" DesiredWidth="200" ItemTemplate="{StaticResource Photos}"/>
然后,您可以在两个控件上使用此验证器:
List<Images> ImageCollection = new List<Images>();
ImageCollection.Add(new Images()
{
ImageURL = Response[i].ProjectImageURL,
ImageText = Response[i].ProjectName
});
}
AdaptiveGV.ItemsSource = ImageCollection;