The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Sync Requests with RxJS and Angular

Sync Requests with RxJS and Angular

4:56
When you implement a search bar, the user can make several different queries in a row. With a Promise based implementation, the displayed result would be what the longest promise returns. Here we see how RxJs can be used to avoid this problem.
Watch this lesson now
Avatar
egghead.io

When you implement a search bar, the user can make several different queries in a row. With a Promise based implementation, the displayed result would be what the longest promise returns. Here we see how RxJs can be used to avoid this problem.

Avatar
Gadi

very cool.

Where is the module import for the Rx lib? I was expecting it in the angular.module( 'App', ['rx'] {})

PS. The JSBin code not working correctly, you get the previous results and it takes a long time to refresh.

In reply to egghead.io
Avatar
Joel

very cool.

Where is the module import for the Rx lib? I was expecting it in the angular.module( 'App', ['rx'] {})

PS. The JSBin code not working correctly, you get the previous results and it takes a long time to refresh.

Rx is a global library at window.Rx. Personally, I'd wrap Rx in a factory for injection for testability. It wouldn't be required though.

The responses are slow because the fakeService timeouts are 1.5 and 3 seconds. You can adjust that.

In reply to Gadi
Avatar
Christian Crowhurst

Is it possible / advisable to use RxJs 5 with AngularJS 1.5+?

I was thinking of trying to integrate RxJs with AngularJS but I though I would need to use a combination of RxJs 4 and the rx.angular.js bindings (https://github.com/Reactive-Extensions/rx.angular.js)

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?