如何删除必填字段中的星号,并在角度2和角度材料2中的占位符之前替换自定义星号

前端之家收集整理的这篇文章主要介绍了如何删除必填字段中的星号,并在角度2和角度材料2中的占位符之前替换自定义星号前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用angular5和angular material2.我想删除所需字段的星号或星号.我还想在占位符之前添加自定义星号或星号.

<mat-form-field>
      <input matInput placeholder="Applicant Name" name="inputApplicantName" 
      [(ngModel)]="inputApplicantName" required>
 </mat-form-field>

解决方法

从输入中删除required属性;
用mat-form-field中的标记替换占位符属性,并尝试使用它的样式;

A placeholder is a text label displayed in the input area when the input does not contain text. When text is present,the placeholder will float above the input area. The placeholder can be specified either via a placeholder attribute on the input or a < mat-placeholder > element in the same form field as the matInput

猜你在找的Angularjs相关文章