模板解析错误:意外的结束标记“表单”。当标签已经被另一个标签关闭时,可能会发生

时间:2019-04-17 17:26:02

标签: 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(“     

[错误->]

我应该在哪里弄错..?

2 个答案:

答案 0 :(得分: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 :(得分:0)

第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标签