找不到管道“键值”。在9号角
"@angular/animations": "^9.0.1",
"@angular/common": "~9.0.1",
"@angular/core": "~9.0.1",
"@angular/forms": "~9.0.1",
"@angular/platform-browser": "~9.0.1",
"@angular/platform-browser-dynamic": "~9.0.1",
"@angular/router": "~9.0.1",
<div *ngFor="let item of faqData | keyvalue; let i=index">
{{item.key}}:{{item.value}}
</div>
<p>Map</p>
<div *ngFor="let item of map | keyvalue">
{{item.key}}:{{item.value}}
</div>
faqData = { id: 1, name: "Abdul Rafay" };
object: {[key: number]: string} = {2: 'foo', 1: 'bar'};
map = new Map([[2, 'foo'], [1, 'bar']]);
答案 0 :(得分:1)
它可以fine with Angular9
使用,并且在使用angular 6+的所有版本的应用程序中都可以正常使用。
但是,如果您也可以尝试其他方法。
0
然后在TS
<div *ngFor="let prop of key">
<div>key: {{prop}}</div>
<div>value: {{faqData [prop]}}<div>
</div>
FIX: OP发现他在导入下缺少CommonModule