Angular7 Ngrx6 withLatestFrom警告

时间:2019-04-15 01:32:05

标签: angular ngrx rxjs6

使用withLatestFrom时出现问题。控制台显示以下错误:

您在期望流的位置提供了“ undefined”。您可以提供一个Observable,Promise,Array或Iterable

代码是:

import { first, map, distinctUntilChanged, withLatestFrom } from 'rxjs/operators';

    this.subscriptionList.push(
        this.store
            .select(fromReducer.getSelectedProduct)
            .pipe(withLatestFrom(this.store.select(fromReducer.getAllUrlConfigurationEntities)))
            .pipe(
                map(([product, urlConfigurations]) => {
                    const my_product = product || {};
                    return {
                        urlConfigurations,
                        product: my_product
                    };
                }),
                distinctUntilChanged((previous: any, current: any) => current.urlConfigurations.length === 0 || previous.product.id === current.product.id)
            )
            .subscribe(data => {
                const urlConfigurations = data.urlConfigurations;
                console.log(urlConfigurations);
                if (urlConfigurations) {
                    this.urlConfigurations = JSON.parse(JSON.stringify(urlConfigurations));
                }

                return;
            })
    );

我尝试返回类似.pipe(withLatestFrom(this.store.select(fromReducer.getAllUrlConfigurationEntities)))的可观察对象。

但是我之后需要该值,而不是Observable。

感谢您的帮助和时间!

1 个答案:

答案 0 :(得分:0)

您必须使用from yourapp import create_app from flask_script import Manager, Server from yourapp import config app = create_app(config.DevelopmentConfig) manager = Manager(app) manager.add_command("runserver", Server(host=app.config['HOST'], port=app.config['PORT'])) if __name__ == '__main__': manager.run() 选择器,而不是减速器中的createSelector