html - 是什么导致我的 Angular 模板中出现此错误消息:E 解析模板中的错误:意外的结束标记“div”
问题描述
这是我的 html 模板文件:
<div class="container"
fxLayout="row wrap"
fxLayout.sm="column"
fxLayout.xs="column"
fxLayoutAlign.gt-md="space-around center"
fxLayoutGap="10px"
fxLayoutGap.xs="0">
<div fxFlex="100" dir="rtl">
<div>
<h3 *ngIf="">اطلاعات کاربر</h3>
<hr>
</div>
</div>
<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>
</div>
<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>
</p>
-->
</mat-list-item>
</mat-list>
</div>
<div [hidden]="user || errMess">
<mat-spinner></mat-spinner><h4>Loading . . . Please Wait</h4>
</div>
<div *ngIf="errMess">
<h2>Error</h2>
<h4>{{errMess}}</h4>
</div>
</div>
<!--
<form novalidate [formGroup]="commentForm" #cform="ngForm" (ngSubmit)="onSubmit()">
<p>
<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>
</p>
<button type="submit" mat-button class="background-primary text-floral-white" [disabled]="commentForm.invalid">Submit</button>
</form>
-->
这是我得到的错误:
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 ("
</p>
</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>
</div>
[ERROR ->]</div>
<!--
"): C:/Users/m/Desktop/SEP/version1-frontend/src/app/users/users.component.html@52:0
有什么问题,为什么我会收到此错误消息?我检查了每个标签几次,似乎一切正常,而且我的 V 代码 IDE 中也没有错误,但是当我运行程序时,npm start
我收到上述错误消息!请帮助我知道问题是什么,我该如何解决?
解决方案
您需要关闭mat-card标签。
<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**
</div>
推荐阅读
- python - 我有一个被忽略的while循环,即使它不应该| 硒 | Python
- flutter - ListView 兼容 StatefulWidget
- javascript - How to prevent letters from being entered in a numeric input field in Ant Design library (React js)
- kubernetes - 为什么有人想在 Kubernetes 中使用 GCE Persistent Disk 或 EBS?
- javascript - 如何限制正则表达式中的字符范围?
- c# - @Html.Label 在内容具有点 (.) 时不显示 - Bootstrap MVC Razor
- c++ - 如何在不使用标志变量或函数的情况下在 C++ 中查找某个范围内的素数?
- node.js - 在 express 中使用 DELETE 方法后如何重定向页面?
- c - 存储随机数和 Yes No 循环有问题
- python-3.x - Pytorch DDP get stuck in getting free port