Javascript 角度5误差:Can';t绑定到';ngForFor';因为它不是';t'的已知属性;李';

Javascript 角度5误差:Can';t绑定到';ngForFor';因为它不是';t'的已知属性;李';,javascript,angular,typescript,Javascript,Angular,Typescript,我的category.component.ts是 我的category.component.html是 {{title} {{item2.CategoryName} 我的category.service.ts是 从'@angular/core'导入{Injectable}; 从'@angular/common/http'导入{HttpClient}; 从“./Category”导入{Category}; 从“rxjs”导入{Observable}; @可注射() 导出类类别服务{

我的category.component.ts是

我的category.component.html是

{{title}
    {{item2.CategoryName}
我的category.service.ts是

从'@angular/core'导入{Injectable};
从'@angular/common/http'导入{HttpClient};
从“./Category”导入{Category};
从“rxjs”导入{Observable};
@可注射()
导出类类别服务{
构造函数(私有http:HttpClient){}
getCategories():可观察{
返回this.http.get
('http://northwindapi.azurewebsites.net/api/categories');
}
}

问题是Angular不接受ngFor的li。如何解决此问题?

将表达式中的的更改为的

<li *ngFor='let item2 of categories'>


请将您的代码粘贴到您的问题中:1)我无权查看您的png文件,403禁止。2) 没有多少人会为了测试而重新键入图片中的所有代码。您需要在声明类别组件的模块中导入
CommonModule
。@Faisal如果注释中给出的提示不是错误的原因,则无需注释或以更清楚的方式澄清注释的原因谢谢您的回答。谢谢你所做的一切,伙计:)
<h3>{{title}}</h3>
<ul>
<li *ngFor='let item2 for categories'>
  {{item2.CategoryName}}
</li>
</ul>
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Category } from './category';
 import { Observable } from 'rxjs';
@Injectable()
export class CategoryService {

constructor(private http: HttpClient) { }
getCategories(): Observable<Category[]> {
 return this.http.get<Category[]> 
 ('http://northwindapi.azurewebsites.net/api/categories');
 }
  }
<li *ngFor='let item2 of categories'>