Closed emcniece closed 7 years ago
Got it figured out. As many others have mentioned, WifiWizard
is available as a global and does not need to be imported.
The WifiWizard
class can be faked out by declaring it above the component using it, and it will still be available in the emulator or when running on a mobile device. declare let WifiWizard any;
home.ts:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Network } from 'ionic-native';
declare let WifiWizard: any;
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
public events: any;
constructor(public navCtrl: NavController) {
this.events = [];
if(typeof WifiWizard !== 'undefined') console.log(WifiWizard)
else console.warn('WifiWizard not loaded');
};
}
I plan to create a service that uses WifiWizard when available, and falls back to some mocked methods when it is not available. There are mocked classes available for the Ionic Native plugins, so it probably isn't harmful to build a custom mock for WifiWizard. If anyone wants me to share this, pipe up!
I'm attempting to get this running inside a Ionic v2 app, which uses Typescript and Angular 2. As you can guess, integration so far has been a challenge.
Has anyone tried importing this plugin within Typescript/ng2?
So far, my
app/pages/home/home.ts
looks like this: