WindowsAzure is not defined


#1

Hi everyone,

I want to use Azure App Services with Ionic 2. I have installed the Cordova plugin with the folowing command:
cordova plugin add cordova-plugin-ms-azure-mobile-apps
However, if i want to initiate an instance of WindowsAzure.MobileServiceClient it always throws an error: “WindowsAzure is not defined”.

Data provider:

@Injectable() 
 export class Data {
  client: WindowsAzure.MobileServiceClient;
  todoItemTable: WindowsAzure.MobileServiceTable;

  getData():WindowsAzure.asyncPromise {
    if (!this.client) {
      this.client = new WindowsAzure.MobileServiceClient('url.azurewebsites.net');
    }
    this.todoItemTable = this.client.getTable("todoitem");
    return this.todoItemTable.read();
  }

home.ts:

constructor(public navCtrl: NavController,private platform:Platform, private dataService: Data) {
    this.platform.ready().then(()=> {
      this.dataService.getData();
    });
  }

Can someone please give me a solution.
Thanks!


#2

Did you resolve this?


#3

Try to debug with a real device instead of using Ionic serve because Cordova is not available within the browser.