为什么ng-if上的多个条件用angular2显示这个错误?

时间:2017-02-18 06:59:12

标签: angular typescript

我试图检查事件长度是否为0,如果大于2,则使用以下代码检查term.length,

 <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

&GT;

它在控制台上显示模板错误,

Unexpected closing tag "li" ("

1 个答案:

答案 0 :(得分:3)

更改 ngIf 条件
*ngIf="events?.length == 0" && "term.value.length > 2"

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