Yangrui
Yangrui

Reputation: 1247

How to use Cordova Microsoft Azure plugin in ionic 2

Hi I'm using Ionic 2 & Microsoft Azure to create a mobile app. I ran the command

ionic plugin add cordova-plugin-ms-azure-mobile-apps

I was supposed to be able to use Cordova plugins just the way I used in ionic 1. However, this isn't working:

client = new WindowsAzure.MobileServiceClient(this.appUrl);

I got an error message in VS 2015 saying that "Cannot find name WindowsAzure". What's the correct way to use Azure with Ionic 2?

Upvotes: 1

Views: 392

Answers (1)

n00b
n00b

Reputation: 1852

The issue you have is that TypeScript compiler is not able to find a definition for WindowsAzure. You can either declare WindowsAzure in a .d.ts file like this

declare var bootbox: any;

or the better alternative is to use 'Definitly Typed' using this command in our source folder.

typings install dt~azuremobileservicesclient --global

Remember you need typings to be installed which is a node package

npm install typings --global

https://www.npmjs.com/package/typings

Note: the declaration you get from 'typings' is not guaranteed to match your Cordova plugin.

Upvotes: 0

Related Questions