Rxjs Theme next or onNext

I am completely new to rjjs to be patient. For example, in this lesson http://blog.angular-university.io/how-to-build-angular2-apps-using-rxjs-observable-data-services-pitfalls-to-avoid/ but I saw the same code in ng book

I see

let subject = new Rx.Subject(); subject.subscribe(value => console.log('Received new subject value: ')) subject.next(newValue); 

but if I put the code in the browser, I have

s ubject.next is not a function

so if you look at the document https://github.com/Reactive-Extensions/RxJS/blob/master/doc/gettingstarted/subjects.md

 var subject = new Rx.Subject(); subject.subscribe(value => console.log('Received new subject value: ',value)) subject.onNext(2); 

Can you explain to me why the textbook and book use the following? What am I missing?

+6
source share
1 answer

It seems you are using the wrong version of rxjs (4.x). Angular2 uses rxjs 5 https://github.com/ReactiveX/rxjs/

See also http://reactivex.io/rxjs/

+9
source

All Articles