1
我有一个屏幕,我想在不同的模式下使用.. 添加/更改/查询/删除。因此,在询价在Ionic 3/Angular4中有条件添加表单到html模板
/删除模式,我也不会用形式或输入字段..
我然后在NG-容器跨越一个问题来了是不是足够聪明,知道我是调理我的形式声明在两个单独的语句中输入字段介于两者之间。
此代码导致模板解析错误:
<ng-container *ngIf="useForm()">
<form [formGroup]="gvarForm"
novalidate
(ngSubmit)="submit()">
</ng-container>
....
<ng-container *ngIf="useForm()">
</form>
</ng-container>
错误:
Runtime Error
Template parse errors: Unexpected closing tag "ng-container". 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 (" novalidate (ngSubmit)="submit()"> [ERROR ->]</ng-container> <ng-container *ngIf="useForm()"> </form> "): ng:///SharedModule/[email protected]:6 Unexpected closing tag "form". 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 (" </ng-container> <ng-container *ngIf="useForm()"> [ERROR ->]</form> </ng-container> </ion-content> "): ng:///SharedModule/[email protected]:6 Unexpected closing tag "ion-content". 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 (" </form> </ng-container> [ERROR ->]</ion-content> <ion-footer> <ion-toolbar> "): ng:///SharedModule/[email protected]:0
Stack
Error: Template parse errors:
Unexpected closing tag "ng-container". 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 ("
novalidate
(ngSubmit)="submit()">
[ERROR ->]</ng-container>
<ng-container *ngIf="useForm()">
</form>
"): ng:///SharedModule/GvarDetailPag[email protected]:6
Unexpected closing tag "form". 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 ("
</ng-container>
<ng-container *ngIf="useForm()">
[ERROR ->]</form>
</ng-container>
</ion-content>
"): ng:///SharedModule/[email protected]:6
Unexpected closing tag "ion-content". 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 ("
</form>
</ng-container>
[ERROR ->]</ion-content>
<ion-footer>
<ion-toolbar>
"): ng:///SharedModule/[email protected]:0
at syntaxError (http://localhost:8100/build/vendor.js:79188:34)
at DirectiveNormalizer.normalizeLoadedTemplate (http://localhost:8100/build/vendor.js:91005:19)
at DirectiveNormalizer.normalizeTemplateSync (http://localhost:8100/build/vendor.js:90981:21)
at DirectiveNormalizer.normalizeTemplate (http://localhost:8100/build/vendor.js:90955:43)
at CompileMetadataResolver._loadDirectiveMetadata (http://localhost:8100/build/vendor.js:91893:75)
at http://localhost:8100/build/vendor.js:92089:54
at Array.forEach (<anonymous>)
at CompileMetadataResolver.loadNgModuleDirectiveAndPipeMetadata (http://localhost:8100/build/vendor.js:92088:41)
at http://localhost:8100/build/vendor.js:103284:58
at Array.forEach (<anonymous>)
但这并不:
<ng-container *ngIf="useForm()">
<form [formGroup]="gvarForm"
novalidate
(ngSubmit)="submit()">
</form>
</ng-container>
这让我觉得我要去必须重写该事物并且不能使用DRY原则。
其他人碰到过吗?
因为你要复制的标签和标记的格式文本与非格式文本。使用方便。我只希望Angular不会对我执行规则。如果我在一节中没有关闭表单的形式,让我。作为开发者,责任应该在我身上,而不是直接夹克我:-) – JGFMK