我在一页上有mat-form-field:-
<mat-form-field class="form-control-full-width">
<input type="text" matInput placeholder="First Name" formControlName="firstNameFC" required>
<mat-error *ngIf="hasNewUserError('firstNameFC', 'required') && isNewUserSubmitted">
First Name is required
</mat-error>
</mat-form-field>
应用了以下 CSS:-
.mat-form-field-label {
/*change color of label*/
color: white !important;
}
.mat-form-field-underline {
/*change color of underline*/
background-color: white !important;
}
.mat-form-field-ripple {
/*change color of underline when focused*/
background-color: white !important;;
}
.mat-input-element{
color: white !important;
}
CSS 按预期反映。
问题是我在不同的页面上有另一个 mat-form-field 并且想在该字段上应用不同的 CSS(颜色:绿色,背景颜色:白色)。
是否可以在不同页面的控件上应用不同的 CSS?