merge two object arrays with Angular 2 and TypeScript?

前端 未结 6 526
长情又很酷
长情又很酷 2020-12-14 05:19

I have gone across the JavaScript questions on this topic, this question is specifically about Angular2 with TypeScript.

What I am trying to do is to concatenate the

6条回答
  •  有刺的猬
    2020-12-14 05:39

    The spread operator is kinda cool.

    this.results = [ ...this.results, ...data.results];
    

    The spread operator allows you to easily place an expanded version of an array into another array.

    You can read about spread operator here.

提交回复
热议问题