“如果输入元素可以有多个错误状态,则由消费者决定应该显示哪些消息.这可以通过CSS,ngIf或ngSwitch来完成.”
没有例子,我无法在任何地方找到它.
这是我的HTML:
... <form (ngSubmit)="onSubmit(registrationForm)" #registrationForm="ngForm"> ... <md-input-container floatPlaceholder="never"> <input mdInput type="email" placeholder="Enter your email address" name="email" [(ngModel)]="email" required email> <md-error class="required">Email is required.</md-error> <md-error class="email">Invalid email.</md-error> </md-input-container> ...
任何提到的解决方案(CSS,ngIf或ngSwitch)都可以,但我更喜欢CSS.