2017-01-05 14 views
7

Tôi gặp một số lỗi trong bảng điều khiển và không chắc chắn vấn đề là gì trong số HTML. Bất kỳ trợ giúp sẽ được đánh giá cao.Lỗi "div" không mong đợi của thẻ đóng 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> 

Trả lời

8

Bạn đã có một dấu nháy kép quá nhiều tại *ngIf="errorMessage && !successMessage"":

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

Không có ví dụ nào tốt hơn về trường hợp sử dụng lý do đóng "lỗi chính tả". –

+0

@torazaburo ohhh, có điều gì không? Tôi không biết! :) sau đó có, bạn chắc chắn phải – PierreDuc

+0

Oh của tôi. Cảm ơn bạn. – Cookies

1

Lỗi này xảy ra khi bạn mở một yếu tố và không đóng nó. lỗi này xuất hiện trong ví dụ này:

<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> 

Như bạn thấy tôi không đóng <ion-list> phần tử (nên </ion-list>)

Hãy cẩn thận:

Nếu bạn sử dụng bất kỳ thuộc tính nguyên tố với các giá trị của nó khi trình phân tích cú pháp không thể xử lý chúng, phần tử sẽ được mở và lỗi này xảy ra ("" ở ví dụ trên).

Các vấn đề liên quan