我正在尝试使用“名字”和“姓氏”等自定义输入来制作自定义注册表单,而不是“全名”。但是,当我创建了自定义通知并开始将焦点切换到背景或其他输入时,必须出现“需要名字!” 等等。这些东西不起作用。
代码:
div class="form-control-group">
<label class="label" for="input-name">First name:</label>
<input nbInput
[(ngModel)]="user.name"
#name="ngModel"
type="text"
id="input-name"
name="name"
placeholder="First name"
fullWidth
fieldSize="large"
[status]="name.dirty ? (name.invalid ? 'danger' : 'success') : 'basic'"
[required]="getConfigValue('forms.validation.name.required')"
[minlength]="getConfigValue('forms.validation.name.minLength')"
[maxlength]="getConfigValue('forms.validation.name.maxLength')"
[attr.aria-invalid]="name.invalid && name.touched ? true : null">
<ng-container *ngIf="name.invalid && name.touched">
<p class="caption status-danger" *ngIf="name.errors?.required">
name is required!
</p>
<p class="caption status-danger" *ngIf="name.errors?.minlength || name.errors?.maxlength">
name should contain
from {{ getConfigValue('forms.validation.name.minLength') }}
to {{ getConfigValue('forms.validation.name.maxLength') }}
characters
</p>
</ng-container>
</div>