我有一个控制器:
.controller('myController', ['$scope','$http', function ($scope,$http,) {
$scope.saveit = function () {
$scope.key = '';
$http.get('/getHash',{"key": $scope.key})
.success(function(response, status, headers, config){
$scope.key = response.key;
});
}
console.log ($scope.key) // key is empty
}
为什么最后是$scope.key
空的?