tengoTengo un array de elementos donde solo quiero traer el primero. ("sale_price"sale_price
), pero en ngForngFor
trae todos los "sale_price"
<*ngFor="let valor of equipo.equipment_details;">{{valorsale_price
.sale_price}}</>
Código Angular:
"equipment_details": [
{
"id": 7,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.933975Z",
"modified": "2017-11-16T14:49:46.839778Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
},
{
"id": 6,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.933417Z",
"modified": "2017-11-16T14:49:46.875055Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
},
{
"id": 8,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.934477Z",
"modified": "2017-11-16T14:49:46.740048Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
}
]
<*ngFor="let valor of equipo.equipment_details;">{{valor.sale_price}}</>
Objeto:
"equipment_details": [
{
"id": 7,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.933975Z",
"modified": "2017-11-16T14:49:46.839778Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
},
{
"id": 6,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.933417Z",
"modified": "2017-11-16T14:49:46.875055Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
},
{
"id": 8,
"sale_price": "0",
"customer_price": "None",
"group_plans": [],
"created": "2017-10-23T21:07:12.934477Z",
"modified": "2017-11-16T14:49:46.740048Z",
"memory": null,
"is_active": false,
"start": "2017-11-16T21:57:14.299810Z",
"equipment": 28,
"promotion": null
}
]