2017-02-18 36 views
0

我想檢查事件長度爲0,如果term.length大於2用下面的代碼,爲什麼ng-if上的多個條件在angular2中顯示這個錯誤?

<li class="more-result" *ngIf="events?.length == 0" && "term.value.length > 2"> 
       <span class="tab-content-area-active-location">   
        No events found in {{selectedCountry}} 
       </span> 
</li 

>

它顯示在控制檯上作爲模板錯誤,

Unexpected closing tag "li" (" 

回答

3

變化ngIf

*ngIf="events?.length == 0" && "term.value.length > 2" 
狀態

*ngIf="events?.length == 0 && term.value.length > 2" 
+0

分析器錯誤:表達意外結束:事件。長度== 0 &&在表達式的結尾[?事件。長度== 0 &&] – Sajeetharan