我从Js函数中选择了用户当前输入字段是readOnly,所以一旦我们从selectedOwner
获得值,我想将输入字段背景颜色更改为白色,因为用户不希望看到灰色来自readOnly指令?有没有办法实现这种要求?
main.html中
<div class="form-group col-md-6">
<div class="col-md-6">
<label class="control-label required" for="rcsaOwner">RCSA
Owner :</label>
</div>
<div class="col-md-6">
<input type="text" class="form-control" id="rcsaOwner" required ng-class="{'background1': color.back}"
ng-model="riskAssessmentDTO.rcsaOwnerWorker" name="rcsaOwnerWorker"
ng-click="openRcsaOwner()" ng-model-options="{updateOn: 'blur'}" ng-readOnly="true"/>
<p class="text-danger"
ng-show="addAssessment.rcsaOwnerWorker.$touched && addAssessment.rcsaOwner.$error.required">RCSA
Owner is required</p>
</div>
</div>
mainCtrl.Js
$scope.selectedOwner = function (selectedOwner, workerKey) {
this.$parent.$parent.rcsaOwnerModal.close();
$scope.riskAssessmentDTO.rcsaOwnerWorkerKey = workerKey;
$scope.riskAssessmentDTO.rcsaOwnerWorker = selectedOwner;
$scope.color = { back: true};
};
的main.css
.background1 {
background-color: #eeee12;
color: red;
}