Reactive-Extensions / rx.angular.js

AngularJS Bindings for RxJS
Other
827 stars 89 forks source link

ScopeSchedular not working (with Rx 4.0.7) #130

Open Roaders opened 8 years ago

Roaders commented 8 years ago

I think Scope Schedular needs to be updated to work with Rx 4.0.7. I get the following:

TypeError: state is not a function at rx.angular.js:604 at Scope.$eval (angular.js:16251) at Scope.$apply (angular.js:16351) at ScopeScheduler.Rx.ScopeScheduler.ScopeScheduler.schedule (rx.angular.js:602) at ScopeScheduler.schedulerProto.scheduleRecursive (rx.all.js:1108) at ObserveOnObserver.Rx.internals.ScheduledObserver.ScheduledObserver.ensureActive (rx.all.js:1934) at ObserveOnObserver.next (rx.all.js:1955) at ObserveOnObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (rx.all.js:1752) at ObserveOnObserver.tryCatcher (rx.all.js:63) at AutoDetachObserverPrototype.next (rx.all.js:11612)

It also cannot be used in place of the Rx.Scheduler.currentThread:

Error:(15, 6) TS2322: Type 'ScopeScheduler' is not assignable to type 'ICurrentThreadScheduler'.
 Property 'scheduleRequired' is missing in type 'ScopeScheduler'.
mattpodwysocki commented 8 years ago

@Roaders can you give me a code example where this is not working?

Roaders commented 8 years ago

@mattpodwysocki sure. Check out this branch:

https://github.com/Roaders/SpotifyExportTool/tree/scope_schedular

just paste in one track and you'll get an error in the console. In this example the Rx.Scheduler.immediate is set to a new ScopeSchedular in app.ts and this is then used in SpotifyExportController.

I am trying to figure out a better way of just using ScopeSchedular for all rx operations so angular always gets updated.

samal-rasmussen commented 8 years ago

I tried .observeOn(new Rx.ScopeScheduler($rootScope)) and got the same error. I'm on rx.angular 1.1.3, rx 4.1.0, and angular 1.5.5.