1

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?

daedsidog
  • 1,637
  • 2
  • 10
  • 33
wai wong
  • 23
  • 3

1 Answers1

0
    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);
      });
    }
Yushin
  • 1,460
  • 3
  • 17
  • 34