简体   繁体   English

使用Ionic 2,导入后无法访问Observable

[英]Using Ionic 2, I am not able to access Observable after importing it

Can anybody lend a hand? 有人可以伸出援手吗? Been stuck on this Ionic 2 / Observable thing for 2 days. 被卡在Ionic 2 / Observable上2天。

Basically it's saying Observable is not defined. 基本上是说Observable没有定义。 You will see where im trying to access it where the debugger is in the fetchData method in the service. 您将在服务的fetchData方法中看到调试器在哪里尝试访问它。 http://pastebin.com/FJKACFeq http://pastebin.com/FJKACFeq

I believe you need to: 我相信您需要:

import { Observable }                   from 'rxjs';

Instead of: 代替:

import { Observable }                   from 'rxjs/Observable';

Pull it from here. 从这里拉出来。

import { Observable } from 'rxjs/Rx';

If that didn't work then maybe you can post your System.config. 如果那不起作用,那么您可以发布System.config。

So in case anyone is wondering this in the future, turned out the Object was there all along, but because of the way the build process works it wont show with a debugger. 因此,如果将来有人对此感到疑惑,原来该对象一直存在,但是由于构建过程的工作方式,它不会与调试器一起显示。 Have to use console.log. 必须使用console.log。 Wasted day and a half to figure that out. 浪费了一天半的时间弄清楚了。 Thankfully I had a lifeline haha :) 幸运的是我有一条生命线哈哈:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以将observable设置为undefined或null吗? - Am I able to set an observable to undefined or null? 我无法以角度访问 object 的属性 - i am not able to access the properties of object in angluar 我无法在Ionic2上做出承诺 - I am not able to set my class into a promise on Ionic2 即使在使用 clearInterval 之后,如果条件满足,我也无法停止 setInterval() - I am not able to stop setInterval() after the if conditions satisfies even after using clearInterval 在离子2应用中使用可观察的承诺 - Using promise with observable in ionic 2 applications 我无法访问我使用 ngFor 循环创建的 DOM 元素,并且我正在从服务中获取数据。 Angular - I am not able to access DOM element which I am creating using ngFor loop and I am getting the data from the service. Angular 我无法从 NgRx 商店中获取项目,并且 observable 仍未定义 - I am not able to fetch items from the NgRx store and the observable remains undefined 为什么我无法在 Angular 中订阅来自不同模块的 observable(而 setter 也可以工作) - Why am I not able to subscribe to an observable from a different module(while setter also works) in Angular 映射后如何在水龙头中访问原始可观测值? - How can I access original observable value in tap after map? 为什么我可以访问班级的私人成员? - Why am I able to access private member of the class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM