2016-07-24 62 views
6

我很新的rxjs東西要耐心等待。 例如,在本教程中 http://blog.angular-university.io/how-to-build-angular2-apps-using-rxjs-observable-data-services-pitfalls-to-avoid/ ,但我看到了NG-書相同的代碼Rxjs主題next或onNext

我可以看到

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

,但如果我把代碼在瀏覽器中我有

小號ubject.next不是一個函數

,所以如果我看看到文檔 爲什麼教程和書 使用下一個

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

你能解釋一下嗎?我錯過了什麼?

回答