1

In Angular2. When I call onNext on a Subject, it shows unsolved. rx is correctly imported.

import { Subject } from 'rxjs/Subject';
...
private _subject = new Subject();

...
this._progress$ = Observable.create(observer => {
      this._progressObserver = observer
    }).share();
    this._subject = Subject.create(this._progressObserver, this._progress$);

...
this._subject.onNext(10/100);
Hammer
  • 8,538
  • 12
  • 44
  • 75

1 Answers1

2

It's .next(). not onNext()

this._subject.next(10/100);
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Gunter, I check the api online for https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/subjects/subject.md, and the observable,observer it inherits from, https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/observable.md and https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/observer.md. I did not find next()? – Hammer May 09 '16 at 02:25
  • This is for RxJS 4, Angular uses 5 https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#observer-interface-changes-also-subjects – Günter Zöchbauer May 09 '16 at 02:56