I am using ionic 2
Downloaded the plugin from https://github.com/salbahra/cordova-plugin-networkinterface
Can't use any global variable or call any other function inside the function
networkinterface.getIPAddress(function (ip) { alert(ip);});
If I use something like this
networkinterface.getIPAddress(function (ip)
{ alert(ip);
this.test(ip); });
test(x){
console.log("IP = "+ x);}
I get an error:
Error in Success callbackId: networkinterface1280836273 : TypeError: Cannot read property 'test' of null.
I get the Ip alert properly but I can't access it outside the provided function. Also typerscript gives the error:
[ts] Cannot find name 'networkinterface'.
When I use the plugin. But it still compiles and works.
Any idea how to solve the issue?