Hello,
Using Ionic RC5 and cordova latest.
I want to use gimbal bridge plugin but in platform.ready it gives me error like.
[ts] Property ‘UAGimbal’ does not exist on type ‘Window’
Here is my code below.
constructor(public auth: Auth, public loadingCtrl: LoadingController, platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();
window.UAGimbal.start(
function(result){
//Called on success
},
function(error){
//Called on error such as permissions denied
}
);
});
For more info about plugin will be here. https://github.com/urbanairship/cordova-gimbal-bridge
Can anybody advise me please?
-Naitik joshi
Do
declare var UAGimbal:any
UAGimbl.start(
(res) => console.log(res),
(err) => console.log(err)
)
Hi Hartington,
Thanks for your quick response but once declaring variable under MyApp gives following error.
declare var UAGimbal:any;
[ts] Unexpected token. A constructor, method, accessor, or property was expected.
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { HomePage } from '../pages/home/home';
import { LoginPage} from '../pages/login/login';
import { Auth } from '../providers/auth';
import { LoadingController } from 'ionic-angular';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
declare var UAGimbal:any;
rootPage: any = LoginPage;
loader: any;
constructor(public auth: Auth, public loadingCtrl: LoadingController, platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();
UAGimbl.start(
(res) => console.log(res),
(err) => console.log(err)
);
});
this.presentLoading();
this.auth.login().then((isLoggedIn)=> {
if(isLoggedIn){
this.rootPage = HomePage
} else {
this.rootPage = LoginPage
}
this.loader.dismiss();
});
}
presentLoading(){
this.loader = this.loadingCtrl.create({
content: "Please wait...."
});
this.loader.present();
}
}
move the declare var bit to outside of the class