【发布时间】:2018-05-17 12:04:30
【问题描述】:
我是 Angular 的相对初学者,我正在努力理解我从 ng-bootstrap 项目中阅读的一些源代码。 The source code can be found here。
我对 ngOnInit 中的代码很困惑:
ngOnInit(): void {
const inputValues$ = _do.call(this._valueChanges, value => {
this._userInput = value;
if (this.editable) {
this._onChange(value);
}
});
const results$ = letProto.call(inputValues$, this.ngbTypeahead);
const processedResults$ = _do.call(results$, () => {
if (!this.editable) {
this._onChange(undefined);
}
});
const userInput$ = switchMap.call(this._resubscribeTypeahead, () => processedResults$);
this._subscription = this._subscribeToUserInput(userInput$);
}
在这些 Observable 函数上调用 .call(...) 有什么意义?这是试图实现什么样的行为?这是正常模式吗?
作为我 Angular 教育的一部分,我已经阅读/观看了很多关于 Observables(不是双关语)的内容,但我从未遇到过这样的事情。任何解释将不胜感激
【问题讨论】:
标签: javascript angular rxjs observable ng-bootstrap