I
I
Ivan-P2017-03-17 13:12:28
Angular
Ivan-P, 2017-03-17 13:12:28

How to return Observable from Subscription?

There is a js class X with a loadMore method:

loadMore(): Subscription {
        this.loadingSubscription = this.more().subscribe(res => {
                this.objects.push.apply(this.objects, res.objects);
                return this.objects;
            }, er => {
             
            });
        return this.loadingSubscription;
    }

how in the case of "er" in another method, for example ErHandler, write an Observable that will produce er, so that it would be possible in the component where X is used to subscribe to X.ErHandler.subscribe()?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question