ANGULAR:如何更改 Material 中所需的*?

标签 angular

我希望输入中所需的“*”颜色为红色。 为此,我导入并使用 react 形式和 Angular Material 。还没有 CSS,因为我不知道如何使用输入中所需的元素来编辑它。

Click to see Image

<form (ngSubmit)="changePassword()">
          <mat-form-field floatLabel="always">
            <input required type="password"  matInput placeholder="Old password">
          </mat-form-field>

最佳答案

CSS 选择器是

.mat-placeholder-required.mat-form-field-required-marker {
  color: red;
}

See it in action

请务必创建 deep styling如果您在组件中设置它的样式,或者放入全局样式文件,例如 style.css (就像我所做的那样)

关于ANGULAR:如何更改 Material 中所需的*?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58282490/

相关文章:

angular - FormControl 显示 ",required(control)"作为其值

angular - 错误 TS2339 : Property 'combineLatest' does not exist on type 'typeof Observable'

javascript - (Angular2 RC5) 如何使用 SystemJS 为每个模块创建一个可以由路由器延迟加载的包?

angular - 如何减小产品包大小?

javascript - 如何避免 tr 内的分页符?

Angular - 如何防止具有依赖可观察量的嵌套管道?

javascript - 无法设置未定义的属性 'someProperty' - Angular Typescript

angular - 如何使用 Angular v4.x 安装 Angular-CLI

angular - 在 MatButtonToggleGroup 指令上设置默认值

angular - ng build --prod index.html 文件没有生成后?