1
I am trying to create a variable to set one of the properties of an object obtained by the get method.
When I give console no subscribe I recover the value of the array, but I’m having difficulty (being beginner) to set only one of the proprierades of the objects of this array.
Component:
this.mainService.getGraph()
.subscribe(res => {
console.log(res)
this.name = res[''].map(res => res.name)
console.log(this.name)
Console.log:
Put a number instead of ' ' ' here: res['']. map . If you solve let me know that I will put as a response.
– Leticia Rosa
already put, as Undefined also.
– felipenoka
In your question it was not very clear. You want the
this.name
receive only one of the names present in the array? Or receive an array like all the names in the original array?– Leonardo Lima
an array with all the names of the original array. the goal is to take these values to create a chart.
– felipenoka