Integrating Azure Mobile Services and ionic.bundle.min.js throwing error

.controller('HomeCtrl', function ($scope, $stateParams, AzureMobileServiceClient) {
AzureMobileServiceClient.AzureClient.query('Users', {})
    .then(function (users) {
        $scope.users = users;
    }, function (err) {
        console.error('Error querying azure service ' + err);
    }) 
})

.factory('AzureMobileServiceClient', function() {
return {
    AzureClient: new WindowsAzure.MobileServiceClient('https://site-url.azure-mobile.net/', 'API_KEY')
};
})

The above is the controller (simple), AzureMobileServiceClient is a .factory right now, I’ve also tried using Angular constant but the ionic.bundle.min.js throws an error ‘TypeError: undefined…’ when it reaches the .query();

I’ve replaced my url and apikey here, but in the app they’re defined. When debugging I can inspect the controller code and AzureClient is configured correctly and I see the methods, etc listed (using Chrome dev tools). Is there known issue integrating Azure Mobile Services with Ionic? I’m using v1.0.0-beta.14.

1 Like