这是我的密码:
public antplus: any;
public SelectId: any;
constructor(public navCtrl: NavController) {
this.antplus = (<any>window).antplus;
this.antplus.searchDevices('HEARTRATE', function(device) {
console.log(JSON.stringify(device));
console.log("Ant ID=" + device.antDeviceNumber);
this.SelectId = device.antDeviceNumber;
},(error)=>{console.log("Error Search="+error);});
}在控制台上将显示信息:控制台(64) "Ant ID=4077“。
但是也会得到错误消息:在“成功”中,callbackId: Antplus1239198979 : TypeError:无法设置属性'SelectId‘为null。
以前有人遇到过这个问题吗?
发布于 2018-12-16 07:39:30
public antplus: any;
public SelectId: any;
constructor(public navCtrl: NavController) {
this.antplus = (<any>window).antplus;
this.antplus.searchDevices('HEARTRATE', (device) => {
console.log(JSON.stringify(device));
console.log("Ant ID=" + device.antDeviceNumber);
this.SelectId = device.antDeviceNumber;
},(error) => {
console.log("Error Search="+error);
});
}https://stackoverflow.com/questions/53793909
复制相似问题