Last active
March 14, 2019 10:47
-
-
Save arturovt/e4d49b4fcddfcba27ed950b63f635657 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
@Injectable() | |
export class TodosEffects { | |
@Effect() | |
public setTodos$ = this.actions$.pipe( | |
ofType(Actions.GET_TODOS), | |
exhaustMap(() => someService.getTodos()), | |
map((todos) => ({ | |
type: Actions.SET_TODOS, | |
payload: todos | |
})) | |
); | |
constructor(private actions$: Actions) {} | |
} | |
// В рантайме после вызова декораторов | |
class TodosEffects { | |
public static '__@ngrx/effects__' = [ | |
{ | |
propertyName: 'setTodos$', | |
dispatch: true | |
} | |
]; | |
public setTodos$ = ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment