2017-04-10 52 views
0

我有一個登錄屏幕離子應用程序。當我輸入正確的用戶名和密碼時,它可以在我的電腦的chrome中正常工作。但是當我做同樣的設備,它提供了以下錯誤:應用程序登錄工作在鉻,但不是在設備上

Failed to load resource: the server responded with a status of 404 (Not Found) controllers.js:130 response error is = 

這裏是我的代碼controller.js:

$scope.enterlogin = function(usern,pass) 
{ 
    var config = { 
     params: { uname: usern, passw: pass } 
    } 

    var url = 'http://xx.xx.x.xxx/UserService3/WebService1.asmx'; 
    $http.get(url + '/getUserbyUsername' + '?uname=' + usern + '&passw=' + pass).success(function(response) { 
    // stuff 
     console.log('response is = ' + JSON.stringify(response)); 
     if(response['IsExisting'] == null) 
     { 
      console.log('null existing = ' + response['IsExisting']); 
      alert('Please check your credentials. Account does not exist.'); 
     } 
     else 
     { 
      console.log('not null existing = ' + response['IsExisting']); 
      sharedProperties3.setUserID(response['UserID']); 
      console.log('setuserid = ' + sharedProperties3.getUserID()); 

      $scope.hide(); 
      if($window.localStorage.getItem('has_run') == '') 
      { 
       //do some stuff if has not loaded before 
       $window.localStorage.setItem('has_run', 'true'); 
       $state.go('helpExtra'); 
      } 
      else 
      { 
       $scope.hide(); 
       $state.go('menu.mainMenu'); 
      } 

     } 
    }) 
    .error(function(response) { 
    // error stuff 
     console.log('response error is = ' + response); 
    }); 

我可以用我的手機瀏覽器/鍍鉻看到web服務,我安裝了白名單插件,並將其添加到我的index.html文件中:

meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'" 

可能是什麼問題?

+0

是路徑是否正確? –

+0

@RohithKD路徑? –

+0

@RohithKD是的,我可以登錄使用PC的鉻。 –

回答

0

我將此添加到config.xml文件:

<access origin="*" /> 
相關問題