angualr-cli
アプリケーションではRxjs
を使用しています。エラーrxjs_Observable __。Observable.forkJoinは関数ではありませんか?
ERROR TypeError: __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__.Observable.forkJoin is not a function
at ViewerComponent.webpackJsonp../src/app/component/viewer.component.ts.ViewerComponent.someFunction(http://localhost:4200/main.bundle.js:4022:73)
at http://localhost:4200/main.bundle.js:3951:31
としてしかし、私はインポートする場合Rxjs
完全に()すべての作品viewer.component.ts
//Other Imports
import { Observable } from 'rxjs/Observable';
//omitting for brevity
export class ViewerComponent implements OnInit, AfterViewInit, OnDestroy {
someFunction(someArg){
//omitting for brevity
let someArray: any = [];
//Add some info
Observable.forkJoin(someArray).subscribe(data => {
//Do something with data
});
}
//omitting for brevity
}
で
。エラーはありません。 私は、何が必要なのか分かりました。 私もrxjs/Observable/forkjoin
をインポートしようとしていますが、役に立たないものはありません。
どのようにこのことについて進むための指針。
- どちらかが一つのパッケージ
- としてすべての演算子をインポートしたり、あなたのようなインポートを使用する最初のケースでは、各事業者に個別
をインポートします。
あなたはimportによって完全に何を意味しますか? – Sajeetharan
質問を更新しました。 完全に 'import 'を意味しますrxjs';' – Ankesh
何が配列ですか?それは何を含んでいますか? –