I am trying to get my head around Observables in RxJs. I have a page with Search box and when user start typing then Webservice returns 20 results and then when i press Show More then next 20 results are displayed and so on.
I am able to get first 20 results successfully but next 20, i am not able to merge with earlier ones.
Service
@Injectable()
export class AppService {
constructor(private http : Http) {}
search(terms : Observable < string >) {
    return terms
      .debounceTime(400)
      .distinctUntilChanged()
      .switchMap(term => this.searchEntries(term));
  }
searchEntries(term) {
    const API = "https://jsonplaceholder.typicode.com/posts/";
    return this
      .http
      .get(API)
      .map(res => res.json());
  }
}
Component
export class AppComponent {
resp : Object;
searchTerm = new Subject < string > ();
constructor(private _searchService : AppService) {
this
  ._searchService
  .search(this.searchTerm)
  .subscribe(results => {
    this.resp = results;
  });
 }
}
HTML
<span *ngFor="let res of resp | slice:0:10">
      <a href="#" class="lex-column align-items-start">
        <div class="d-flex w-100 justify-content-between">
          <h5 class="mb-1">{{res.title}}</h5>
          <small># {{res.id}}</small>
        </div>
        <p class="mb-1">{{res.body}}</p>
        <small >Donec id elit non mi porta.</small>
      </a>
 </span>
I have replaced API URL to general one
Please help in combining next 20 results to previously shown results.
 
    