如何在打字稿中将数组推入另一个非空数组?如果需要的话加入

Kof*_*Yah 3 arrays join push typescript angular

该数组至少包含 10 个对象

 array: any[] = [];
Run Code Online (Sandbox Code Playgroud)

当调用函数时,数组应包含“item”中的现有对象和新对象。

 function () {
    var timeline = this.service.fetchservice(10)
    .map((result : Response) => result.json())
    .subscribe(item=> {
          this.array.push(item);
        });
    }
Run Code Online (Sandbox Code Playgroud)

控制台错误

ERROR TypeError: _this.array.push is not a function
Run Code Online (Sandbox Code Playgroud)

Car*_*ten 7

就像是:

 this.results = this.results.concat(data.results);
Run Code Online (Sandbox Code Playgroud)