Reactive-Extensions / rx.angular.js

AngularJS Bindings for RxJS
Other
827 stars 89 forks source link

Don't run $apply if the scope was destroyed #149

Open kayhadrin opened 8 years ago

kayhadrin commented 8 years ago

This can happen when the "stream" that triggers safeApply was completed after the scope was destroyed (e.g. the angular app was destroyed, which happens during jasmine unit tests)

Maybe we could also put a $destroy event listener to stop this observable as soon as it happens.

Right now, without this change, I would get an error like "TypeError: Cannot read property '$$phase' of null" when the angular app is already destroyed.