Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created February 20, 2019 07:02
Show Gist options
  • Save lydemann/afa3f9eb5b77ad579390002d17b22876 to your computer and use it in GitHub Desktop.
Save lydemann/afa3f9eb5b77ad579390002d17b22876 to your computer and use it in GitHub Desktop.
todo-list.selector.ts
export const getTodolistState = createFeatureSelector<TodoListState>('todoList');
export const todoListSelectorFn = createSelector(
getTodolistState,
(todoListState) => todoListState.todos
);
@Injectable({
providedIn: 'root'
})
export class TodoListSelector {
/**
*
*/
constructor(private store: Store<TodoListState>) {}
/**
* getTodoList
*/
public getTodoList() {
return this.store.select(todoListSelectorFn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment