角度材料2无法抑制所需的星号

时间:2017-02-07 21:49:42

标签: angular material-design angular-material angular-material2

我努力压制占位符上的星号以获取所需的输入并选择角度材质2形式的字段。这是html:

  <form class="project-info-container">
    <h3 color="primary">Inputs</h3>
    <md-input-container>
      <input md-input placeholder="Contact Email" [(ngModel)] = "contact.email" name="email" md-no-asterisk required>
    </md-input-container><br />
    <md-input-container>
      <input md-input placeholder="Permit Number" [(ngModel)] = "project.permitNumber" name="number" md-no-asterisk required>
    </md-input-container><br />
    <md-input-container>
      <input md-input placeholder="Project Name" [(ngModel)] = "project.projectName" name="name" md-no-asterisk required>
    </md-input-container><br />
    <md-input-container>
      <input md-input placeholder="Project Address" [(ngModel)] = "project.address" name="address" md-no-asterisk required >
    </md-input-container><br />
    <md-select [(ngModel)] = "submissionNumber" name = "subnum" class = "submission-select" color="primary" placeholder="Submission Number" md-no-asterisk required>
      <md-option *ngFor = "let sub of subs" [value] = "sub">
        {{sub}}
      </md-option>
    </md-select>
  </form>

正如您所看到的,我尝试使用md-no-asterisk属性,但无济于事。另外,我在以下样式表中删除了占位符类的::after样式:

/node_modules/@angular/material/input/input.css
/node_modules/@angular/material/input/input.scss
/node_modules/@angular/material/select/select.css
/node_modules/@angular/material/select/select.scss

表格仍然用星号表示,我很难理解为什么。非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您可以查看此Pr:https://github.com/angular/material2/pull/4237/files/c395b2019459f1e24494dcdcce21e6aa8e4bd899#diff-57ec6b8f9c25230070b7d749bc04c51b

您可以将一个元素调用hideRequiredMarker用于您的案例

String ABC = "ABC'S URL";
String chromeDriverPath = "C:\\selenium\\chromedriver.exe" ;
System.out.println("start selenium");
File file = new File(chromeDriverPath);
System.setProperty("webdriver.chrome.driver",file.getAbsolutePath());
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
capabilities.setCapability("pageLoadStrategy", "none");
webDriver driver = new ChromeDriver(capabilities);
driver.get(ABC);

不到一个月前它就已经推出了大师,所以你需要一个最新版本的角度和放大器。材料