salbahra / cordova-plugin-networkinterface

Provide a method for Cordova applications to retrieve the device IP Address.
http://albahra.com/projects
72 stars 51 forks source link

"use strict" angularjs #11

Closed JohannesHoffmann closed 7 years ago

JohannesHoffmann commented 8 years ago

I tried to use this plugin to get the local ip address. inside a angular2 (maybe also angular1) application the console shows a lot of errors. i figured out that "use strict" will be added by transpiler typescript or other javascript compilers. Is it possible to fix the plugin to work with "use strict"? Does someone has the same issue?

salbahra commented 7 years ago

Which errors are you referring to? The JS portion of the plugin is only 8 lines of code, hard to imagine a lot of errors being generated due to that. If you could share I can take a look.

rahuldmk commented 7 years ago

networkinterface.getIPAddress(function (ip) { alert(ip); }); Error ReferenceError: networkinterface is not defined

dhavalshah007 commented 7 years ago

any update on this ??

salbahra commented 7 years ago

Please add the following line to your TypeScript before referencing the plugin:

declare var networkinterface: any;

dhavalshah007 commented 7 years ago

i have used this line. But still not working.

On Jun 3, 2017 23:05, "Samer Albahra" notifications@github.com wrote:

Please add the following line to your TypeScript before referencing the plugin:

declare var networkinterface: any;

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/salbahra/cordova-plugin-networkinterface/issues/11#issuecomment-305989900, or mute the thread https://github.com/notifications/unsubscribe-auth/AGSCwpg8nW7AjQgB9zscLwki6vDwTZd4ks5sAZlsgaJpZM4H8Qtx .

salbahra commented 7 years ago

Please share a code snippet that does not work. Something I can run and reproduce the issue your seeing.

dhavalshah007 commented 7 years ago
declare var networkinterface:any;   
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  public rootPage:any = HomePage;

platform.ready().then(() => {
    networkinterface.getWiFiIPAddress(function(ip){
    console.log(ip);
    this.toast.show(ip, '2000', 'bottom').subscribe(
        toast => {
                console.log(toast);
        });
    });
}

Error : ReferenceError: networkinterface is not defined.

In Mobile, Toast Notification is not coming , and in browser I am getting above error.

JFernandoGomez commented 7 years ago

same as @dhavalshah007