Reputation: 17432
I have array productData
with 69 elements and productDatagreen
with 659 elements in angular
application. When I do push
all the 659 elements are going inside index 69 same thing happening cancat
. Then I have total length
of array 70.
I need length
of array 69+659 and items should be in same row. How can I do that. This is my code.
this.productData.push(this.productDatagreen)
this.productData= this.productData.concat([this.productDatagreen])
this.mapImageSeries.data=this.productData;
this.Chart.validateData();
Array screenshot
Upvotes: 1
Views: 159
Reputation: 2422
You could do something like this
this.productData =[...this.productData,...this.productDatagreen]
console.log(this.productData.length);//will console 728
Upvotes: 1
Reputation: 17432
As per the @phil's comment.
this.productData.push(...this.productDatagreen)
Worked for me.
Upvotes: 1