2017-01-05 74 views
7

我在控制檯中發現了一些錯誤,不知道HTML中存在什麼問題。任何幫助,將不勝感激。意外的結束標記「div」error angular2 HTML

error_handler.js:51 EXCEPTION: Uncaught (in promise): Error: Template parse errors: Unexpected closing tag "div" (" Click here to Signup [ERROR ->] "): [email protected]:1 Error: Template parse errors: Unexpected closing tag "div" (" Click here to Signup [ERROR ->] "): [email protected]:1

<section class="reset-password"> 
<div class="container container-responsive inner-top-xs"> 
    <form [formGroup]="resetPasswordForm" (ngSubmit)="resetPassword(resetPasswordForm.value, resetPasswordForm.valid)"> 
     <h4>Please enter your e-mail address and a temporary password will be sent to you.</h4> 
     <div class="form-group"> 
      <label class="control-label" for="email">Email</label> 
      <input type="text" formControlName="email" required class="form-control" id="email" placeholder="Email"> 
      <validation-message [control]="resetPasswordForm.controls.email"></validation-message> 
     </div> 
     <button type="submit" class="btn btn-flat__blue outer-top-xs" [disabled]="!resetPasswordForm.valid">RESET PASSWORD</button> 
    </form> 
    <div class="alert alert-dismissible alert-danger outer-top-xs" *ngIf="errorMessage && !successMessage""> 
     <button type="button" class="close" data-dismiss="alert">&times;</button> 
     {{errorMessage}} 
    </div> 
    <div class="alert alert-dismissible alert-success outer-top-xs" *ngIf="successMessage"> 
     <button type="button" class="close" data-dismiss="alert">&times;</button> 
     {{successMessage}} 
    </div> 
    <div class="outer-top-xs"> 
     <a [routerLink]="['/getstarted']">Click here to Signup</a> 
    </div> 
</div> 
</section> 

回答

8

你已經有了一個雙引號太多的*ngIf="errorMessage && !successMessage""

<div class="alert alert-dismissible alert-danger outer-top-xs" *ngIf="errorMessage && !successMessage"> 
<!--at the end of this line--> 
+0

使用「拼寫錯誤」的原因幾乎沒有更好的例子。 –

+0

@torazaburo ohhh,有這樣的事嗎?我不知道! :)那麼是的,你絕對是對的 – PierreDuc

+0

哦,我的。謝謝。 – Cookies

1

,當你打開一個元素,並且不關閉其發生這個錯誤。

<ion-list *ngSwitchCase="'facilities'"> 
<ion-item *ngFor="let facility of facilities"> 
    <ion-icon name="facility.Icon" item-start></ion-icon> 
    {{facility.Name}} 
    <ion-icon color="red" name="rose" item-end></ion-icon> 
</ion-item> 
<ion-list> 

正如你看到的,我不收<ion-list>元素(應該是</ion-list>

注意:

如果你使用任何元素的屬性 這個錯誤在這個例子中顯示出來當它的值作爲解析器無法處理它們時,元素將被打開併發生此錯誤(以上例中的「」爲例)。