【问题标题】:RxJS Subject gives me a (SystemJS) Unexpected token <(…)RxJS 主题给了我一个 (SystemJS) 意外令牌 <(...)
【发布时间】:2016-10-15 20:24:59
【问题描述】:

我得到了这个打字稿代码:

_live: Subject<Match[]> = new BehaviorSubject<Match[]>(null);
_pre: Subject<Match[]> = new BehaviorSubject<Match[]>(null);

但我不断收到此错误:

(SystemJS) 意外令牌

当这 2 个变量被删除时,其他一切正常。是否有解决此问题或其他替代主题的方法?

【问题讨论】:

    标签: angular typescript rxjs


    【解决方案1】:

    尝试像这样导入主题-

    import { Subject }          from 'rxjs/Subject';
    

    或者像这样从 RxJS 导入所有东西-

    import 'rxjs/Rx'; 
    // adds ALL RxJS statics & operators to Observable
    

    看看这是否有帮助。

    【讨论】:

      猜你喜欢
      • 2017-05-14
      • 1970-01-01
      • 2017-07-08
      • 2020-04-21
      • 2017-06-30
      • 2019-03-22
      • 2014-12-26
      • 1970-01-01
      • 2021-03-26
      相关资源
      最近更新 更多