添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

What causes this error message in my Angular template: ERROR in E parsing template: Unexpected closing tag "div"

Ask Question </mat-card-title> </mat-card-header> <img mat-card-image src="{{ baseURL + default_user.filename}}" > <mat-card-content> <p>{{user.lastname}}</p> </mat-card-content> <div fxFlex="40" *ngIf="user" [@visibility]="visibility" [@expand]> <mat-list> <h3>مشخصات</h3> <mat-list-item > <h4 matLine> {{user.firstname}} </h4> <p matLine> {{user.lastname</p> <p matLine> <span> -- {{comment.author}} {{comment.date | date }} </span> </mat-list-item> </mat-list> <div [hidden]="user || errMess"> <mat-spinner></mat-spinner><h4>Loading . . . Please Wait</h4> <div *ngIf="errMess"> <h2>Error</h2> <h4>{{errMess}}</h4> <form novalidate [formGroup]="commentForm" #cform="ngForm" (ngSubmit)="onSubmit()"> <mat-slider min="1" max="5" step="1" thumbLabel tickInterval="1" name="rating" formControlName="rating"></mat-slider> <mat-form-field class="full-width"> <textarea matInput formControlName="comment" placeholder="Your Comment" rows=12></textarea> <mat-error *ngIf="formErrors.comment">{{formErrors.comment}}</mat-error> </mat-form-field> <button type="submit" mat-button class="background-primary text-floral-white" [disabled]="commentForm.invalid">Submit</button> </form>

And this is the error I get:

ERROR in Errors parsing template: Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
      </mat-card-content>
  [ERROR ->]</div>
  <div fxFlex="40" *ngIf="user" [@visibility]="visibility" [@expand]>
"): C:/Users/m/Desktop/SEP/version1-frontend/src/app/users/users.component.html@27:2, Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
    <h4>{{errMess}}</h4>
[ERROR ->]</div>
"): C:/Users/m/Desktop/SEP/version1-frontend/src/app/users/users.component.html@52:0

What is the problem and why do I get this error message? I checked a couple of time each tags and it seems everything is ok and also i have no errors in my V code IDE but when I run the program by npm start I get the above error message! Please help me know what is the provlem and how can I solve it?

I had a similar issue and the issue was a janky quote in the HTML. I had copied part of it from a website. – Marcie May 30 at 17:10

You need to close mat-card tag.

<div fxFlex="40" *ngIf="user" [@visibility]="visibility" [@expand]>
<mat-card>
  <mat-card-header>
    <mat-card-title>
      <h3>{{user.firstname | uppercase}}</h3>
    </mat-card-title>
  </mat-card-header>
  <img mat-card-image src="{{ baseURL + default_user.filename}}" >
  <mat-card-content>
    <p>{{user.lastname}}</p>
  </mat-card-content>
 </mat-card> //<--- **This one is missing**
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.