Guest User

Untitled

a guest
Feb 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. `@State<PostStateModel>({
  2. name: 'posts',
  3. defaults: {
  4. posts: [],
  5. request: {
  6. loading: false,
  7. error: null,
  8. }
  9. }
  10. })
  11.  
  12. export class PostState{
  13. constructor(private postService: PostService) {}`
  14.  
  15. @Selector()
  16. static posts(state: PostStateModel){
  17. return state.posts;
  18. };
  19. static request(type: string){
  20. return createSelector([PostState], (state: PostStateModel) => {
  21. console.log(type);
  22. console.log(state.request[type])
  23. return state.request[type];
  24. })
  25. }
Add Comment
Please, Sign In to add comment