This is my code:
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);});
}
At the console will show [INFO:CONSOLE(64)] "Ant ID=4077".
But also get Error message : in Success callbackId: Antplus1239198979 : TypeError: Cannot set property 'SelectId' of null.
Anyone get this problem before?
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);
});
}