Rx主题未定义

时间:2018-09-05 14:43:11

标签: angular typescript rxjs

在此命名空间中,我导出一个字符串类型的Rx主题:

public IEnumerable<SiloNode> GetLinks(IEnumerable<SiloNode> masterList)
{
    foreach(var node in masterList) 
    {
        yield return node;
        foreach(var children in GetLinks(node.Children))
            yield return children;
    }
}

WITH RECURSIVE employee_paths AS ( SELECT employeeNumber, reportsTo managerNumber, officeCode, 1 lvl FROM employees WHERE reportsTo IS NULL UNION ALL SELECT e.employeeNumber, e.reportsTo, e.officeCode, lvl+1 FROM employees e INNER JOIN employee_paths ep ON ep.employeeNumber = e.reportsTo ) SELECT employeeNumber, managerNumber, lvl, city FROM employee_paths ep INNER JOIN offices o USING (officeCode) ORDER BY lvl, city; 名称空间中的namespace something.TaskHandling { export const taskSelected$ = new Rx.Subject<String>(); 类中,我有:

TaskListComponent

然后在something.TaskHandling.Overview命名空间的public clickListItem() { taskSelected$.onNext('responsive-view-filters'); } 中导入主题:

ResponsiveNavigationComponent

我在something.CustomerService中启动流:

import taskSelected$ = something.TaskHandling.taskSelected$;

此代码编译没有问题,当我OnInit public $onInit() { this.observeTaskUpdates(); } private observeTaskUpdates(): void { taskSelected$ .filter(classValue => !!classValue) .subscribe(classValue => { this.toggleView(classValue); }); } 时,我最终遇到了导出的go to definition主题。

但是当我运行该应用程序时,我在ResponsiveNavigationComponent.ts中得到了它:

  

TypeError:无法读取未定义的属性“ filter”

因此taskSelected没有在我的taskSelected$类中定义。我想念什么?

1 个答案:

答案 0 :(得分:0)

这不是订单问题,我不得不硬引用启动taskSelected$ const的实际文件> /// <reference path="../TaskHandling/module.ts"/>。不确定这是否是解决潜在问题的方法。