属性绑定ngforof在嵌入式模板上未使用任何指令使用



我正在做懒惰的加载方法。因为我得到了这个问题

Property binding ngForOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".

与下面的代码

 <li ngFor="let page of pager.pages" [ngClass]="{active:pager.currentPage === page}">
   <a (click)="setPage(page)">{{page}}</a>
 </li>

ngFor 的语法将为 *ngFor ,我认为您忘了将*放置在ngFor

之前
   <li *ngFor="let page of pager.pages" [ngClass]="{active:pager.currentPage === page}">
       <a (click)="setPage(page)">{{page}}</a>
   </li>

相关内容

最新更新