2

我正在使用的项目中有一个日期选择器的 html 文件。html如下:

<span class="input-group">
<input type="text" class="form-control" datepicker-popup="MM/dd/yyyy" ng-model="model" min-date="minimum" is-open="opened" datepicker-options="datepickerOptions" date-disabled="notused" close-text="Close" />
<span class="input-group-btn">
<button class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</span>

该文件名为:date-picker.html 我在模式中使用此指令,它工作正常,但我想突出显示输入,以便用户知道它们是必需的。这是我当前的html:

<div style="margin: 5%; display: inline-block;">
<label id="startDateLabel" style="margin-left: 5%">Start Date:</label>
<date-picker id="startDatePicker" type="text" model="updateWrhParams.startDate" style="width: 50%; float: right;" aria-required="true"></date-picker>
</div>

<div style="margin: 5%; display: inline-block;">
<label id="endDateLabel" style="margin-left: 5%">End Date:</label>
<date-picker id="endDatePicker" type="text" model="updateWrhParams.endDate" style="width: 50%; float: right;" aria-required="true"></date-picker>
</div>

我尝试aria-required="true"在日期选择器中添加作为属性无济于事。还尝试添加 requiredclass="requiredField" 最后一个选项在相同的 html 中用于输入和选择字段。日期选择器可以不使用这些属性吗?

更新 属性requiredField是在一个css字段中定义的,用于输入和选择。我需要date-picker在 html 文件中定义的元素中添加这个属性date-picker 所需的属性定义如下:

input.requiredField.ng-valid {
  border: 1px solid #449d44;
  box-shadow: 0px 0px 2px #449d44;
}

input.requiredField.ng-invalid {
  border: 1px solid #A33441;
  box-shadow: 0px 0px 2px #A33441;
}

如何将这些 css 属性应用于日期选择器 html 元素?

4

0 回答 0