Skip to content

Instantly share code, notes, and snippets.

@Willmo36
Created May 29, 2015 09:26
Show Gist options
  • Save Willmo36/87cb6583950fed3b72f1 to your computer and use it in GitHub Desktop.
Save Willmo36/87cb6583950fed3b72f1 to your computer and use it in GitHub Desktop.
Angular Rx safeSubscribe
rx.Observable.prototype.safeSubscribe = function(scope, fn, err, cmp) {
var disposable = this.safeApply(scope, fn).subscribe(angular.noop, err, cmp);
scope.$on("$destroy", function() {
disposable.dispose();
});
return disposable;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment