我正在尝试在我的表单中添加一个检查,以检查结束日期是否小于开始日期,它应该抛出一个不起作用的错误。不知道这里有什么问题。
我的 .html 代码如下:
<label class="col-md-2 form-control-label">Event Starting Date</label>
<div class="col-md-4">
<input class="validate" #startdate="ngModel" [(ngModel)]="input.event_starting_date" name="startdate" type="date" placeholder="Event Starting Date" class="form-control" required>
<div class="alert alert-danger" *ngIf="startdate.touched && !startdate.valid">Starting Date is required!</div>
</div>
<label class="col-md-2 form-control-label">Event Ending Date</label>
<div class="col-md-4">
<input class="validate" #enddate="ngModel" [(ngModel)]="input.event_ending_date" name="enddate" type="date" placeholder="Event Ending Date" class="form-control" required>
<div class="alert alert-danger" *ngIf="enddate.touched && !enddate.valid">Ending Date is required!</div>
<div class="alert alert-danger" *ngIf="enddate<startdate">Ending Date Must be greater than Starting Date!</div>