我的问题很简单,我有一个下面的JSON Typescript对象,我想遍历JSON属性:
{"work_type":"Fabricación","work_type_resp":"Mesa","looking_for":"Relación Calidad/Precio","image":"https://s3-sa-east-1.amazonaws.com/online-quotation-images/153366018967.png","width":"22","high":"34","depth":"","modifications":"mod"}
使用的代码是以下Angular TypeScript组件:
export class DetailsOnlineQuoteModalComponent implements OnInit {
@Input() title;
@Input() values:string;
properties:JSON;
constructor(public activeModal: NgbActiveModal) { }
ngOnInit() {
this.properties=JSON.parse(this.values);
console.log(this.properties);
}
}
我需要做的是遍历JSON的键值属性并在我的HTML中显示它们。非常感谢!