📜  如何使用 *ngFor 迭代对象键 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:22.885000             🧑  作者: Mango

代码示例2
@Component({
  selector: 'keyvalue-pipe',
  template: `
    

Object

{{item.key}}:{{item.value}}

Map

{{item.key}}:{{item.value}}
` }) export class KeyValuePipeComponent { object: {[key: number]: string} = {2: 'foo', 1: 'bar'}; map = new Map([[2, 'foo'], [1, 'bar']]); }