typescript RX-reselect2.ts
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript RX-reselect2.ts相关的知识,希望对你有一定的参考价值。
@Injectable()
class TodosQuery {
getVisibilityFilter$ = this.store.select(state => state.visibilityFilter);
getTodos$ = this.store.select(state => state.todos);
getVisibleTodos$ = Observable.combineLatest(
getVisibilityFilter$, getTodos$, this.getVisibleTodos
)
private getVisibleTodos = (visibilityFilter, todos) => {
switch (visibilityFilter) {
case 'SHOW_ALL':
return todos
case 'SHOW_COMPLETED':
return todos.filter(t => t.completed)
case 'SHOW_ACTIVE':
return todos.filter(t => !t.completed)
}
}
constructor(private store: Store<AppState>) {}
}
以上是关于typescript RX-reselect2.ts的主要内容,如果未能解决你的问题,请参考以下文章
typescript RX-reselect2.ts
TypeScript 环境配置
TypeScript入门学习之路
typescript TypeScript Snippets #typescript
TypeScript入门五:TypeScript的接口
TypeScript系列教程--初探TypeScript