如何从Angular Material的必填字段中删除星号 [英] How do I remove asterisk from required field in Angular Material
问题描述
在角材料中将输入字段定义为必需
时,它会在标签后自动添加一个星号.我发现了很多问题,询问如何添加它,却没有如何删除它.看来在他们提出问题时并不是默认设置,但根据此 https://github.com/angular/material **).如何删除它并获得与@Styx在此处所示的相同行为.
When defining a input field as required
in angular material, it automatically adds a asterisk after the label. I've found a lot of questions asking how to add it, but none how to remove it. It seems that it wasn't default at the time they asked it, but according to this reference now it is the default behaviour (I'm using the version available on https://github.com/angular/material **).
How do I remove it and get the same behavior as shown here by @Styx.
**当我遇到这个问题时,我以为我使用的是最新版本(1.0.5版),但实际上我使用的是主版本,该版本可能具有星号功能.
**By the time I had this problem I thought that I was using the latest release (v. 1.0.5), but I was in fact using the master version, which could have the asterisk feature.
推荐答案
Even though it looks like this feature is not yet in 1.0.5, release notes ...
我浏览了提交,这可能就是我们正在寻找:
I looked through this commit, and this probably is what we are looking for:
md-no-asterisk
<input md-maxlength="30" required md-no-asterisk name="description" ng-model="project.description">
这是针对此功能的已关闭的问题,状态为需要:合并"
This is the closed issue for this feature, status says 'needs: merge'
这篇关于如何从Angular Material的必填字段中删除星号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!