#html
#HTML
Вопрос:
<div class="container" novalidate>
<form [formGroup]="profileData" (ngSubmit)="register()">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" formControlName="fname" required>
<div>
<div *ngIf="profileData.controls['fname'].hasError('required')" class="alert alert-danger">
**** can't left blank ****
</div>
<div *ngIf="profileData.controls['fname'].hasError('minlength')" class="alert alert-danger">
**** minlength will be 3 ****
</div>
<div *ngIf="profileData.controls['fname'].hasError('maxlength')" class="alert alert-danger">
**** maxlength should be 9 ****
</div>
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" formControlName="lname">
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" formControlName="uemail">
</div>
<div class="form-group" formGroupName="addr">
<div class="form-group">
<label>city</label>
<input type="text" class="form-control" formControlName="ucity">
</div>
<div class="form-group">
<label>Address Lane</label>
<input type="text" class="form-control" formControlName="uaddress">
</div>
</div>
<div class="form-group">
<input type="radio" name="gender" value="male" formControlName="gender"><b>male</b>
<input type="radio" name="gender" value="female" formControlName="gender"><b>female</b>
</div>
<div class="form-group">
<label>country</label>
<select class="form-control" formControlName="ucountry">
<option value="india">india</option>
<option value="usa">usa</option>
<option value="canada">canada</option>
<option value="dubai">dubai</option>
</select>
</div>
<div class="form-group">
<input type="submit" class="btn btn-success">
</div>
</form>
</div>
это выглядит так…
Неперехваченная ошибка: ошибки синтаксического анализа шаблона: неожиданное закрытие тега «форма». Это может произойти, когда тег уже был закрыт другим тегом. Для получения дополнительной информации см. https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (»
[ОШИБКА ->]
где я должен ошибиться в этом ..?
Ответ №1:
Кажется, вы не закрываете тег div здесь
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" formControlName="fname" required>
<div><!-- this is not closed, replace with </div>-->
Вместо
Комментарии:
1. Просто опередите меня 🙂
Ответ №2:
Строка 7
<form [formGroup]="profileData" (ngSubmit)="register()">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" formControlName="fname" required>
<div> <!-- Here -->
Закройте последний тег div