1

my result my result how to get how to get first image is my console log result.

how to get the second image in angular 2 Push Method?

this.limitid = "0";
 this.userService.getTestUsers(this.limitid).subscribe(users => this.users = users);

this.limit = "12";
 this.userService.getTestUsers(this.limit).subscribe(usersnew => this.usersnew = usersnew);

this.users.push(this.usersnew[0]);

console.log(this.users);

the first index(11) objects is this.users results.

the index(12) objects is this.usersnew results.

my question is how to get the index(12) inside objects continues of index(11) to index(23)

image 1

1
  • btw: this is not specific to angular or typescript. It is javascript specific. Commented Oct 24, 2017 at 10:12

2 Answers 2

3

Use ES6 syntax (short and simple):

this.users = [...this.users , ...this.usersnew];
Sign up to request clarification or add additional context in comments.

Comments

1
this.results = this.users.concat(this.usersnew);

Now your new array would be in this.results

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.