2015-07-13 58 views
1

我正在嘗試使用$ http服務調用服務。點擊按鈕後,我打電話給服務,但我收到錯誤。我如何在AngularJS中調用身份驗證登錄服務?

這裏是我的代碼:

$scope.firstrequest = function() { 
    $scope.data = {}; 
    $scope.data.username = "[email protected]%%..test"; 
    $scope.data.password = "@1234"; 
    dataa = "username=" + $scope.data.username + "&" + "password=" + $scope.data.password; 
    console.log('Sign In function called'); 

    if ($scope.data.username && $scope.data.username != "" && $scope.data.password && $scope.data.password != "") { 
     $http({ 
      method: "post", 
      headers: { 
       'Content-Type': 'application/x-www-form-urlencoded' 
      }, 
      url: "https://fulldemo3-yuj****", 
      data: dataa 
     }).success(function(result) { 
      alert('---') 
      // $scope.loader = true; 
      console.log("result:" + JSON.stringify(result)); 



      $scope.loader = false; 
     } 
    }.error(
     function(error) { 

      alert('error') 

     })); 

    } 
} 

回答

相關問題