I'm currently working with Ionic 2
Recently downloaded the plugin from https://github.com/salbahra/cordova-plugin-networkinterface
Attempting to retrieve IP addresses without utilizing global variables or calling other functions within the function
networkinterface.getIPAddress(function (ip) { alert(ip);});
If I attempt something like this
networkinterface.getIPAddress(function (ip)
{ alert(ip);
this.test(ip); });
test(x){
console.log("IP = "+ x);}
An error is thrown:
Error in Success callbackId: networkinterface1280836273 : TypeError: Cannot read property 'test' of null.
The IP alert is displayed correctly, but I can't access it outside the provided function. Additionally, TypeScript displays an error:
[ts] Cannot find name 'networkinterface'.
Despite these errors, the plugin still compiles and works properly.
Any suggestions on how to resolve this issue?