Using "rxjs": "~5.5.2", :
I have pipeable/lettable operators as fields :
hideIndicator = tap(x => this._loadingIndicator.hide());
log = tap(x => ...);
catchError = catchError(error =>....);
Later on I do this :
public post<T>(url: string, params: HttpParams)
{
this._loadingIndicator.show();
return this.http.post<T>(urlJoin(this.actionUrl, url), {params})
.pipe(this.hideIndicator, this.catchError); //<--- notice pipe as operator
}
This ^ code works fine. But I also have GET/DELETE/PUT commands so I don't want to reapeat :
.pipe(this.hideIndicator, this.catchError);.
So it's possible to declare an aggregte method like :

notice that now pipe should be imported. so let's do it :

And :

But I get an error :
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: TypeError: document.createElement is not a function
System.err: File: "<unknown>, line: 1, column: 265
System.err:
System.err: StackTrace:
System.err: Frame: function:'ImmediateDefinition.canUseReadyStateChange', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/util/Immediate.js', line: 56, column: 69
System.err: Frame: function:'ImmediateDefinition', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/util/Immediate.js', line: 30, column: 27
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/util/Immediate.js', line: 208, column: 21
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/scheduler/AsapAction.js', line: 7, column: 19
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/scheduler/asap.js', line: 2, column: 20
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/observable/SubscribeOnObservable.js', line: 8, column: 14
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/operators/subscribeOn.js', line: 2, column: 31
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/operator/subscribeOn.js', line: 2, column: 21
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/add/operator/subscribeOn.js', line: 3, column: 21
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/tns_modules/rxjs/Rx.js', line: 121, column: 1
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/core/services/http.service.js', line: 18, column: 14
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/core/services/index.js', line: 9, column: 24
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/core/helpers/rps-error-handler.js', line: 13, column: 20
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/core/helpers/index.js', line: 6, column: 10
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/core/core.module.js', line: 19, column: 19
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/app.module.js', line: 14, column: 23
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err: Frame: function:'', file:'file:///data/data/com.davidshield.dsapp1/files/app/main.js', line: 5, column: 22
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err: at com.tns.Runtime.runModule(Native Method)
System.err: at com.tns.Runtime.runModule(Runtime.java:530)
System.err: at com.tns.Runtime.run(Runtime.java:522)
System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19)
System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
System.err: ... 8 more
@RoyiNamir it seems that you are hitting this issue where any import from rxjs/Rx will actually import the whole library including the DOM-related stuff.
Remove this line
import { Observable, pipe} from "rxjs/Rx";
and try the following:
import { Observable } from "rxjs/Observable";
import { pipe } from 'rxjs/util/pipe';
Most helpful comment
@RoyiNamir it seems that you are hitting this issue where any import from
rxjs/Rxwill actually import the whole library including the DOM-related stuff.Remove this line
and try the following: