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 json objects to an array.
My code looks something like this,
public results: [];
public getResults(){
this._service.get_search_results(this._slug, this._next).subscribe(
data => {
this.results.concat(data.results);
this._next = data.next;
},
err => {
console.log(err);
}
);
}
How can I concatenate data.results
to this.results
with typescript and angular?
this._slug
and this._next
are set on class.
thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…