2017-05-08 146 views
0

我有一個動態的模板,我收到一條錯誤:角2:ngIf模板解析錯誤

Template parse errors: Unexpected closing tag "button". It may happen when the tag has already been closed by another tag. 

這裏是我的模板:

<ion-col> 
    <button *ngIf=!editMode" class="warning-gradient" (click)="toggleEdit()"><i class="fa fa-edit"></i>Update</button> 
    <button *ngIf="editMode" class="warning-success" (click)="submitForm()"><i class="fa fa-check"></i>Update</button> 
</ion-col> 

...我應該在做不同的事情?

+2

'* ngIf =! 「編輯模式」'你錯過的第一個按鈕打開'「' – jmw5598

+0

@ jmw5598爲*ngIf屬性開幕"你爲什麼不把它作爲答案?似乎是解決方案的OP – sebaferreras

+0

哦,上帝......我盯着那麼久 –

回答

3

你錯過了第一<button>

<ion-col> 
    <button *ngIf="!editMode" class="warning-gradient" (click)="toggleEdit()"><i class="fa fa-edit"></i>Update</button> 
    <button *ngIf="editMode" class="warning-success" (click)="submitForm()"><i class="fa fa-check"></i>Update</button> 
</ion-col>