DimaFr / angular-advanced-ex1

JB Angular Advanced Course Ex1
0 stars 0 forks source link

Subject and Observable? why both? #2

Open ywarezk opened 4 years ago

ywarezk commented 4 years ago

https://github.com/DimaFr/angular-advanced-ex1/blob/046887da1992d0d186d8eff5f36747ee8dc9f4bf/projects/throttling/src/app/directives/tasks.directive.ts#L14

https://github.com/DimaFr/angular-advanced-ex1/blob/046887da1992d0d186d8eff5f36747ee8dc9f4bf/projects/throttling/src/app/directives/tasks.directive.ts#L30

You used both a subject and an observable created with fromEvent, why use both? Why not use the operators directly on the observable? Also you have a memory leak you create a subscription from the observable and the subject and you only unsubscribe from one of them.

DimaFr commented 4 years ago

fixed