このエラーTypeError: Cannot read property 'run' of undefined in Subscriber.js:229が発生 し、理由がわかりません - ionic beta 10 では、このコードは正常に動作します... 11 では動作しません。
import {Component, NgZone} from '@angular/core';
import {NavController} from 'ionic-angular';
declare var io;
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
static get parameters() {
return [NgZone];
}
zone: any;
chats: any;
chatinp: any;
socket: any;
constructor(public navCtrl: NavController, ngzone) {
this.zone = ngzone;
this.chats = [];
this.chatinp ='';
this.socket = io('http://localhost:3000');
this.socket.on('message', (msg) => {
this.zone.run(() => {
this.chats.push(msg);
});
});
}
send(msg) {
if(msg != ''){
this.socket.emit('message', msg);
}
this.chatinp = '';
}
}