2016-03-14 51 views
0

我有問題在控制檯中顯示錯誤消息。我需要顯示「無效的用戶名或密碼。錯誤代碼..」登錄後和2秒後登錄錯誤將更改爲「服務器繁忙請稍後再試。錯誤代碼=」 如何刺激他們在控制檯?這是我的代碼2秒後在控制檯顯示錯誤登錄

var app = angular.module('myApp', []); 

app.controller('login', ['$http','$scope', function ($http,$scope) { 
$scope.hasError = false; 
$scope.errorMessage = ""; 
$scope.input = { 
    username: '', 
    password: '' 
}; 
$scope.isLoading = false; 
$scope.setError = function(hasError){ 
$scope.hasError = hasError; 
}; 
$scope.login = function() { 
    $scope.isLoading = true; 
    var postData = { 
    clazz: "com.smk.aps.server.model.rpc.request.RPCAdminLogin", 
     signature: "", 
     data: { 
    // requestLoginID: app.uuid.v4(), 
    // requestUsername: $scope.input.username, 
    // requestPassword: CryptoJS.SHA1($scope.input.password).toString() 
     } 
    }; 
    postData.data._class = postData.clazz; 

    console.log($scope.input.username) 
    console.log($scope.input.password) 


}; 
}]); 

回答

0

您可以使用$超時用於獲取延遲

$timeout(callAtTimeout, 3000); 
function callAtTimeout(){ 
    console.log(/**/); 
}