2017-04-26 5 views
0

저는 Azure 모바일 서비스를 ionic과 함께 사용하고 있으며 클라이언트를 싱글 톤으로 공장에서 만들려고합니다. 그러나 내가 정상적으로했던 것처럼 클라이언트를 사용하려고 할 때이 오류가 계속 발생합니다. 오류 : 변수를 찾을 수 없습니다 : WindowsAzure. 미리 감사드립니다. 내가 전화오류 : 변수를 찾을 수 없습니다. WindowsAzure

공장

.factory('client', [function(){ 
var myjsonObj = new WindowsAzure.MobileServiceClient('https://xxx.azurewebsites.net'); 
return myjsonObj; 
}]) 

컨트롤러

내가있는 스크립트를 추가를 통해 수동으로 플러그인 모바일 서비스를 추가하기로 결정 그래서 오류를 조사하고 결과를 찾지 못하는 한 후
.controller('loginCtrl', ['$scope', '$stateParams', 'md5', 'Userid', '$state','$ionicSideMenuDelegate','$ionicLoading','client',// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams,md5,Userid,$state,$ionicSideMenuDelegate,$ionicLoading,client) { 

$scope.UserInfo = {}; 

$ionicSideMenuDelegate.canDragContent(false); 


    $scope.show = function() { 
    $ionicLoading.show({ 
     template: '<p>Loading...</p><ion-spinner></ion-spinner>' 
    }); 
    }; 

    $scope.hide = function(){ 
     $ionicLoading.hide(); 
    }; 

$scope.login =function(){ 

$scope.show($ionicLoading); 








    if ($scope.UserInfo.password == null){ 
     $scope.UserInfo.password = "fa"; 
    } 




    var query = client.getTable('clubUser') 
    .where({ Email: $scope.UserInfo.email, Password: md5.createHash($scope.UserInfo.password) }) 
    .read() 
    .done(function(results) { 


     if(results[0] == undefined) 
     { 

      $scope.errorText = "Error: Wrong Username/Password"; 
      $scope.$apply(); 
      $scope.hide($ionicLoading); 
     } 
     else 
     { 
      $scope.hide($ionicLoading); 
      Userid.setJson(results[0].id); 

      $state.go('tabsController.qRCode'); 

     } 




    }, function(error) { 

     console.dir(error); 
     $scope.hide($ionicLoading); 
    }); 

$scope.UserInfo.password = ""; 




}; 



}]) 
+0

스크립트가로드되지 않은 것 같습니다. npm 패키지 또는 스크립트를 사용하고 있습니까? –

+0

나는 내 프로젝트를 cmd에 위치 시켰고 cordova 플러그인을 사용하여 cordova-plugin-ms-azure-mobile-apps를 설치했다. @Volodymyr Bilyachat – Dedawg

+0

Cordova 플러그인은 모바일에서만 작동하며 브라우저에서 실행 중이라고 가정합니다. –

답변

1

내 색인 및 지금 그것은 잘 작동합니다! 도움 주셔서 감사합니다.

0

앱이 '준비'상태 (즉, 모든 자바 스크립트 라이브러리가로드 됨)인지 확인해야합니다. 이오니아에서는 싱글 톤을 보장하기 위해 공장을 이용하는 것이 가장 좋습니다. 그것은 또한 적시에 적재되고 있음을 보증 할 것입니다.

관련 문제