[英]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.