Skip to content

Instantly share code, notes, and snippets.

@samteb
Last active December 28, 2020 08:14
Show Gist options
  • Save samteb/1d3401e9f1bc866e8a986dbd1749d4c6 to your computer and use it in GitHub Desktop.
Save samteb/1d3401e9f1bc866e8a986dbd1749d4c6 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { ArticleModel } from '../../models/article.model';
import { ListService } from './list.service';
@Injectable()
export class ArticlesListService extends ListService {
public listTitle = 'Interesting articles!';
public showNbOfArticlesDropdown = false;
public getList(): Observable<ArticleModel[]> {
return combineLatest([this.pagination$, this.topic$, this.listLevel$]).pipe(
switchMap(([{ first, last }, topic]) => {
return this.apiService.fetchArticles({ first, last, topic });
})
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment