Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When user click charge button, Observable subscribe event endlessly. #16

Closed
llighter opened this issue Jan 30, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@llighter
Copy link
Owner

https://github.com/llighter/ionic-studycard4/blob/b70e3067f4b3c33dd87e6e8e496a339ad12d0144/src/app/decks/deck-detail/deck-detail.component.ts#L103-L115

//emit value every 1s
const interval$ = interval(1000);
//take the first 5 emitted values
const example = interval$.pipe(take(5));
//output: 0,1,2,3,4
const subscribe = example.subscribe(val => console.log(val));

Set take(number) as many as Stage need.

@llighter llighter added the bug Something isn't working label Jan 30, 2019
@llighter
Copy link
Owner Author

@llighter
Copy link
Owner Author

https://www.learnrxjs.io/operators/filtering/takewhile.html

takeuntil_ => isStageFull(1)
위 코드를 pipe에 추가하고 구독하는 부분에서 조건문을 제거한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant