我是新手。所以我不明白变量是如何在离子3中运行的。当我发出HTTP请求时,我无法在构造函数中读取变量的值。谁能帮我?谢谢,亲。
constructor(private fire: AngularFireAuth, public navCtrl: NavController, public navParams: NavParams, public http: Http) {
this.email = fire.auth.currentUser.email;
this.films = this.http.get('https://api.thingspeak.com/channels/329601/feeds.json?results=10');
this.films
.map(res => res.json())
.subscribe(data => {
console.log(data);
this.dulieu = data.feeds;
console.log("Du lieu", this.dulieu[2].field2);
})
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoggedinPage');
}