Efi*_*sky 4 subscribe rxjs angular
我在 RXJS 中读到了这个很棒的功能,理论上它允许我只订阅一个响应,但似乎无法实现它。相反,我收到此错误,
“'Observable' 类型不存在属性 'first'。”
尽管我只是从现有示例中复制粘贴。这是我的代码:
implementHash( token ){
console.log('trying to implement hash', token);
const req = this.http.get('http://localhost:3003/token/' + token );
const sub = req
//.first()
.subscribe( res =>{
sub.unsubscribe; // trying to avoid this line
});
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1339 次 |
| 最近记录: |