【发布时间】:2013-10-21 17:54:07
【问题描述】:
$scope.fetchQA = function() {
$scope.url = 'js/jsons/QA.json';
$http({method: 'GET', url: $scope.url}).
success(function(data, status, headers, config) {
$scope.QA = data;
});
}
$scope.fetchQA();
function x(){
alert(QA);
}
如何使用function x 作为$http.get 的回调?或者有没有其他方法可以确保 x() 只有在接收到fetchQA 中的数据后才会执行?
【问题讨论】: