cvuorinen / angular1-async-filter

Angular2 async pipe implemented as Angular 1 filter to handle promises & RxJS observables
MIT License
59 stars 6 forks source link

Observable<number> evaluates undefined on 0 #3

Closed jukka-varis closed 8 years ago

jukka-varis commented 8 years ago

When using async filter on observable, value is evaluated to undefined instead of 0.

I'm using async to bind length of array to UI: scope.lengthObs = this.selectedItems.map(i => i.length); Where selectedItems is Rx.Observable<any[]>

Html looks like this: <span>{{ lengthObs | async:this }}</span>

When array is not empty, async filter works fine and lenght of array is printed on UI. If array is empty, UI is empty instead of expected 0.

This is line causing the symptom: return values[inputId] || undefined;

cvuorinen commented 8 years ago

Thanks for pointing this out. The || undefined was not necessary so it has been fixed now. Added some tests while I was looking into it ;)