Last active
December 28, 2020 08:14
-
-
Save samteb/1d3401e9f1bc866e8a986dbd1749d4c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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